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


##########
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:
   I think you can do `execution_date = context["logical_date"]`, that one 
should be guaranteed to be a pendulum DateTime.



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