dstandish commented on code in PR #32538:
URL: https://github.com/apache/airflow/pull/32538#discussion_r1261592086


##########
airflow/operators/python.py:
##########
@@ -251,27 +253,37 @@ def execute(self, context: Context) -> Any:
             self.log.info("Proceeding with downstream tasks...")
             return condition
 
-        downstream_tasks = context["task"].get_flat_relatives(upstream=False)
-        self.log.debug("Downstream task IDs %s", downstream_tasks)
+        if not self.downstream_task_ids:
+            self.log.info("No downstream tasks; nothing to do.")
+            return
 
-        if downstream_tasks:
-            dag_run = context["dag_run"]
-            execution_date = dag_run.execution_date
+        dag_run = context["dag_run"]
+        execution_date = dag_run.execution_date
+        if TYPE_CHECKING:
+            assert isinstance(execution_date, DateTime)

Review Comment:
   Ok actually... at least we can use `cast("DateTime", 
dag_run.execution_date)` which is a little cleaner than the assert i suppose



-- 
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