-
Notifications
You must be signed in to change notification settings - Fork 16.4k
Don't fail DagRun when leaf mapped_task is SKIPPED #25995
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't fail DagRun when leaf mapped_task is SKIPPED #25995
Conversation
|
/cc @collinmcnulty @ldacey I think this should fix the issue if you want to try it out. |
510ded2 to
ab64e0f
Compare
This one was a fun one to track down, and was only a problem when the scheduler "expanded" the first mapped task (making it SKIPPED). - The scheduler looks at `add_one` and marks it as SKIPPED. - `unfinished_tis` contains add_one_1, and `_are_premature_tis` changes the state of `add_one__1`, (which just so happens to be a leaf task), and the check on line 584 essentially gets confused, as no one envisaged the states changing! In a reverse of how this normally plays out, if the mini_scheduler in the LocalTaskJob was disabled then this example DAG would deadlock every time. (Since that mini scheduler only operates on a partial DAG it can't ever change the whole DagRun state.) Co-authored-by: Ephraim Anierobi <splendidzigy24@gmail.com>
940cb22 to
d98ca51
Compare
|
Mypy is confusing me: Can't get a "good" fix, having to add a type-ignore. (I'm getting conflicting behaviour. I can fix it either for all files, or for a single file, but not both) |
| ) | ||
|
|
||
| self.trigger_rule = TriggerRule(trigger_rule) | ||
| self.trigger_rule: TriggerRule = TriggerRule(trigger_rule) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mypy really can't work this out? :o
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it has something to do with either (or a combination of) Enum having a custom metaclass, TriggerRule does multi-inheritance, and one of the parents is a built-in.
This one was a fun one to track down, and was only a problem when the scheduler "expanded" the first mapped task (making it SKIPPED).
add_oneand marks it as SKIPPED.unfinished_tiscontainsadd_one__1, and_are_premature_tischanges the state ofadd_one__1, (which just so happens to be a leaf task), and the check on line 584 essentially gets confused, as no one envisaged the states changing!In a reverse of how this normally plays out, if the mini_scheduler in the LocalTaskJob was disabled then this example DAG would deadlock every time. (Since that mini scheduler only operates on a partial DAG it can't ever change the whole DagRun state.)
Fixes #25200
Ephraim had the idea of the fix, I just optomized it to not check the (possibly) large list everytime but only when a state was changed.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rstor{issue_number}.significant.rst, in newsfragments.