-
Notifications
You must be signed in to change notification settings - Fork 14.2k
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
[AIRFLOW-5391] Do not run skipped tasks when they are cleared #7276
Conversation
ee8825b
to
4036e73
Compare
hmm, I use BranchPythonOperator and clear command a lot and I never see the skipped tasks just run on clear. do u use none_failed ? |
@tooptoop4 the problem happens when you clear the skipped task (not when you clear the BranchPythonOperator). There's an example in the linked JIRA. |
i clear entire dag and dont face problem |
@tooptoop4 yes if always clear the entire DAG, the BranchPythonOperator itself gets cleared so you won't face this problem. |
makes sense! |
4036e73
to
c838b3b
Compare
Codecov Report
@@ Coverage Diff @@
## master #7276 +/- ##
===========================================
+ Coverage 32.95% 86.39% +53.43%
===========================================
Files 878 878
Lines 41219 41288 +69
===========================================
+ Hits 13584 35669 +22085
+ Misses 27635 5619 -22016
Continue to review full report at Codecov.
|
9a907c9
to
2c7fae0
Compare
The PR is now ready for review. Reviewers @kaxil @ashb @feluelle please take a look. |
a7ebc52
to
9e094d1
Compare
@ashb @kaxil @feluelle @tooptoop4 Hoping to get a review here. I have updated the PR a bit. The logic is still the same, but the code that does the branching evaluation has been moved into a new dependency rule inside When For example, this comes from "example_short_circuit_operatorschedule": For a DAG that looks like this, After this PR, when the scheduler evaluates the dependency rules for So after this PR, the DAG will look like this after someone clears |
68383ae
to
ca16153
Compare
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.
Overall LGTM. Great test coverage 👍
..would be nice if you could complete the docstrings to contain types and add the types also to the function header.
ca16153
to
af0c3e6
Compare
Hi, @feluelle I've adopted all your suggestions (adding doc and raise ValueError), and the PR has been updated. Please take another look. Thank you! |
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.
Okay, why you are using XCom makes more sense now but I still think it should use a non-default Key (as skip Mixin could be used elsewhere, and we don't want to overwrite possible xcom from the task)
af0c3e6
to
c5a9dd8
Compare
…che#7276) If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override.
…che#7276) If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override. (cherry picked from commit 1cdab56)
If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override. (cherry picked from commit 1cdab56)
If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override. (cherry picked from commit 1cdab56)
If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override. (cherry picked from commit 1cdab56)
If a task is skipped by BranchPythonOperator, BaseBranchOperator or ShortCircuitOperator and the user then clears the skipped task later, it'll execute. This is probably not the right behaviour. This commit changes that so it will be skipped again. This can be ignored by running the task again with "Ignore Task Deps" override. (cherry picked from commit 1cdab56)
This PR fixes the following issue:
If a task is skipped by
BranchPythonOperator
,BaseBranchOperator
orrShortCircuitOperator
and the user then clears the skipped task, it'll execute.After this PR:
The
NotPreviouslySkippedDep
rule will first evaluate if a task has a directSkipMixin
parent that has decided to skip it. This is done by examining the XCom data stored bySkipMixin.skip()
orSkipMixin.skip_all_except()
.The implementation is inspired by the author of this blog.
Issue link: AIRFLOW-5391
Make sure to mark the boxes below before creating PR: [x]
[AIRFLOW-NNNN]
. AIRFLOW-NNNN = JIRA ID** For document-only changes commit message can start with
[AIRFLOW-XXXX]
.In case of fundamental code change, 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 UPDATING.md.
Read the Pull Request Guidelines for more information.