You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "uranusjr (via GitHub)" <gi...@apache.org> on 2023/06/01 01:06:34 UTC
[GitHub] [airflow] uranusjr commented on a diff in pull request #31658: Refactor dag run state determination logic for easier testing
uranusjr commented on code in PR #31658:
URL: https://github.com/apache/airflow/pull/31658#discussion_r1212458567
##########
airflow/models/dagrun.py:
##########
@@ -533,6 +533,25 @@ def get_previous_scheduled_dagrun(self, session: Session = NEW_SESSION) -> DagRu
.first()
)
+ def _tis_for_dagrun_state(self, *, dag, tis):
+ """
+ Return the collection of tasks that should be considered for evaluation of terminal dag run state.
+
+ Teardown tasks by default are not considered for the purpose of dag run state. But
+ users may enable such consideration with on_failure_fail_dagrun.
+ """
+ leaf_task_ids = {t.task_id for t in dag.leaves}
+ leaf_tis = {ti for ti in tis if ti.task_id in leaf_task_ids if ti.state != TaskInstanceState.REMOVED}
+ if dag.teardowns:
Review Comment:
Can use an early return instead
--
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