You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/04/01 08:47:10 UTC

[GitHub] [airflow] ashb commented on a change in pull request #22583: Consider mapped upstream in TriggerRuleDep

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



##########
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:
       ```suggestion
           if ti.task.has_dag() and not any(node.is_mapped for node in ti.task.upstream_list):
   ```




-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org