potiuk commented on a change in pull request #20272:
URL: https://github.com/apache/airflow/pull/20272#discussion_r768218705



##########
File path: airflow/models/baseoperator.py
##########
@@ -578,6 +585,25 @@ def __init__(
         if end_date:
             self.end_date = timezone.convert_to_utc(end_date)
 
+        if retries is not None and not isinstance(retries, int):
+            try:
+                parsed_retries = int(retries)
+            except (TypeError, ValueError):
+                raise AirflowException(f"'retries' type must be int, not 
{type(retries).__name__}")
+            self.log.warning("Implicitly converting 'retries' for %s from %r 
to int", self, retries)

Review comment:
       ```suggestion
               self.log.warning("Implicitly converting 'retries' for task: 
%s.%s from %r to int", dag.dag_id, task_id, retries)
   ```
   
   Even if the above mypy problem is not fixed - might be not best idea to 
log(self) before constructor finishes.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to