[
https://issues.apache.org/jira/browse/AIRFLOW-5391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17115071#comment-17115071
]
ASF GitHub Bot commented on AIRFLOW-5391:
-----------------------------------------
yuqian90 opened a new pull request #8992:
URL: https://github.com/apache/airflow/pull/8992
This PR is backported from https://github.com/apache/airflow/pull/7276. The
original commit was merged into master but not released in v1-10-*. This PR
fixes a few minor merge conflicts and python2.7 compatibility issues and port
it to v1-10-test.
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 1cdab56a6192f69962506b7ff632c986c84eb10d)
---
Make sure to mark the boxes below before creating PR: [x]
- [x] Description above provides context of the change
- [x] Unit tests coverage for changes (not needed for documentation changes)
- [x] Target Github ISSUE in description if exists
- [x] Commits follow "[How to write a good git commit
message](http://chris.beams.io/posts/git-commit/)"
- [x] Relevant documentation is updated including usage instructions.
- [x] I will engage committers as explained in [Contribution Workflow
Example](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#contribution-workflow-example).
---
In case of fundamental code change, Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in
[UPDATING.md](https://github.com/apache/airflow/blob/master/UPDATING.md).
Read the [Pull Request
Guidelines](https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst#pull-request-guidelines)
for more information.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
> Clearing a task skipped by BranchPythonOperator will cause the task to execute
> ------------------------------------------------------------------------------
>
> Key: AIRFLOW-5391
> URL: https://issues.apache.org/jira/browse/AIRFLOW-5391
> Project: Apache Airflow
> Issue Type: Bug
> Components: operators
> Affects Versions: 1.10.4
> Reporter: Qian Yu
> Assignee: Qian Yu
> Priority: Major
> Fix For: 2.0.0
>
>
> I tried this on 1.10.3 and 1.10.4, both have this issue:
> E.g. in this example from the doc, branch_a executed, branch_false was
> skipped because of branching condition. However if someone Clear
> branch_false, it'll cause branch_false to execute.
> !https://airflow.apache.org/_images/branch_good.png!
> This behaviour is understandable given how BranchPythonOperator is
> implemented. BranchPythonOperator does not store its decision anywhere. It
> skips its own downstream tasks in the branch at runtime. So there's currently
> no way for branch_false to know it should be skipped without rerunning the
> branching task.
> This is obviously counter-intuitive from the user's perspective. In this
> example, users would not expect branch_false to execute when they clear it
> because the branching task should have skipped it.
> There are a few ways to improve this:
> Option 1): Make downstream tasks skipped by BranchPythonOperator not
> clearable without also clearing the upstream BranchPythonOperator. In this
> example, if someone clears branch_false without clearing branching, the Clear
> action should just fail with an error telling the user he needs to clear the
> branching task as well.
> Option 2): Make BranchPythonOperator store the result of its skip condition
> somewhere. Make downstream tasks check for this stored decision and skip
> themselves if they should have been skipped by the condition. This probably
> means the decision of BranchPythonOperator needs to be stored in the db.
>
> [kevcampb|https://blog.diffractive.io/author/kevcampb/] attempted a
> workaround and on this blog. And he acknowledged his workaround is not
> perfect and a better permanent fix is needed:
> [https://blog.diffractive.io/2018/08/07/replacement-shortcircuitoperator-for-airflow/]
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)