uranusjr commented on a change in pull request #22583:
URL: https://github.com/apache/airflow/pull/22583#discussion_r840419545



##########
File path: airflow/ti_deps/deps/trigger_rule_dep.py
##########
@@ -83,6 +87,31 @@ def _get_dep_statuses(self, ti, session, dep_context: 
DepContext):
             session=session,
         )
 
+    @staticmethod
+    def _count_upstreams(ti: "TaskInstance", *, session: "Session"):
+        from airflow.models.taskinstance import TaskInstance
+
+        # Optimization: Don't need to hit the database if no upstreams are 
mapped.
+        upstream_task_ids = ti.task.upstream_task_ids
+        if ti.task.dag and not any(ti.task.dag.get_task(tid).is_mapped for tid 
in upstream_task_ids):

Review comment:
       This would be slightly slower (an extra list creation) but I guess it 
doesn’t trump readability in practical scenarios.




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