Correct dagrun state logic when dag is all teardowns#31676
Correct dagrun state logic when dag is all teardowns#31676dstandish merged 2 commits intoapache:mainfrom
Conversation
50443e8 to
d125252
Compare
| if not leaf_task_ids: | ||
| # can happen if dag is exclusively teardown tasks | ||
| leaf_task_ids = {x.task_id for x in dag.tasks if not x.downstream_list} |
There was a problem hiding this comment.
Why do we need a non-empty list of leaves? Does it affect the DAG run state or serve a different purpose?
There was a problem hiding this comment.
Yes you need something to infer dag run state
There was a problem hiding this comment.
So when the teardown task fails, we will fail the dag run even if on_failure_fail_dagrun is not True? I wonder if we can just consider the empty leaves list as all success without looking for the teardown tasks state 🤔
There was a problem hiding this comment.
Yeah it's an odd case. Very much nonsensical edge case that doesn't really make sense. If there's no non teardown tasks then there's no point in ignoring the teardowns. There's no point in even having tasks marked as teardowns in that case. So this seemed like a sensible fallback but we can discuss
Small correction here, to handle the case when dag is all teardowns. In this case, we must simply consider the leaf tasks, whatever they are.
Also fixes issue in main from interaction of two recent prs