You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/02/19 08:02:30 UTC
[GitHub] [airflow] yuqian90 opened a new pull request #7464: [AIRFLOW-4453]
Make behavior of `none_failed` consistent with documentation
yuqian90 opened a new pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464
This is to pick up the work started in https://github.com/apache/airflow/pull/7098. I discussed with @TV4Fun and opened this new PR to continue the work.
- Make behavior of `none_failed` consistent with documentation. Do not skip itself when all parents are skipped.
- Fixing ``none_failed`` breaks the use case where ``BranchPythonOperator`` are nested. So added a fix for creating the ``join`` tasks in ``create_branch_join()``.
---
Issue link: WILL BE INSERTED BY [boring-cyborg](https://github.com/kaxil/boring-cyborg)
Make sure to mark the boxes below before creating PR: [x]
- [x] Description above provides context of the change
- [x] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
- [x] Unit tests coverage for changes (not needed for documentation changes)
- [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).
<sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
---
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 closed pull request #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 closed pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r392107927
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
Hi @kaxil sorry for the late reply. Yes I think your suggestion sounds good. I'll think a bit more and work on fixing none_failed, and adding none_failed_or_skipped.
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **increase** coverage by `21.44%`.
> The diff coverage is `96.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
===========================================
+ Coverage 65.44% 86.88% +21.44%
===========================================
Files 927 928 +1
Lines 44963 44988 +25
===========================================
+ Hits 29425 39087 +9662
+ Misses 15538 5901 -9637
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <ø> (+28.13%)` | :arrow_up: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `94.04% <85.71%> (+73.26%)` | :arrow_up: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/providers/google/cloud/operators/vision.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy92aXNpb24ucHk=) | `99.63% <0.00%> (+0.36%)` | :arrow_up: |
| [...osoft/azure/operators/azure\_container\_instances.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9henVyZV9jb250YWluZXJfaW5zdGFuY2VzLnB5) | `78.28% <0.00%> (+0.65%)` | :arrow_up: |
| [airflow/cli/cli\_parser.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9jbGkvY2xpX3BhcnNlci5weQ==) | `98.13% <0.00%> (+0.93%)` | :arrow_up: |
| [...rflow/providers/databricks/operators/databricks.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZGF0YWJyaWNrcy9vcGVyYXRvcnMvZGF0YWJyaWNrcy5weQ==) | `92.24% <0.00%> (+1.72%)` | :arrow_up: |
| ... and [492 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r389835407
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
What do you think of having 2 trigger rules?
1) Fixed "none_failed"
2) none_failed_or_skipped
(2) can be used to get current "non_failed" like feature, isn't it?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yustoris commented on issue #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yustoris commented on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-596191550
Any progress here?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **decrease** coverage by `0.61%`.
> The diff coverage is `72.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
==========================================
- Coverage 65.44% 64.82% -0.62%
==========================================
Files 927 928 +1
Lines 44963 44988 +25
==========================================
- Hits 29425 29163 -262
- Misses 15538 15825 +287
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `67.96% <ø> (+0.41%)` | :arrow_up: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `19.04% <0.00%> (-1.74%)` | :arrow_down: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `28.16% <0.00%> (-58.46%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/pod.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZC5weQ==) | `42.50% <0.00%> (-50.00%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
| [airflow/kubernetes/kube\_client.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL2t1YmVfY2xpZW50LnB5) | `37.14% <0.00%> (-40.00%)` | :arrow_down: |
| ... and [9 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **increase** coverage by `21.44%`.
> The diff coverage is `96.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
===========================================
+ Coverage 65.44% 86.88% +21.44%
===========================================
Files 927 928 +1
Lines 44963 44988 +25
===========================================
+ Hits 29425 39087 +9662
+ Misses 15538 5901 -9637
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <ø> (+28.13%)` | :arrow_up: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `94.04% <85.71%> (+73.26%)` | :arrow_up: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/providers/google/cloud/operators/vision.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy92aXNpb24ucHk=) | `99.63% <0.00%> (+0.36%)` | :arrow_up: |
| [...osoft/azure/operators/azure\_container\_instances.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9henVyZV9jb250YWluZXJfaW5zdGFuY2VzLnB5) | `78.28% <0.00%> (+0.65%)` | :arrow_up: |
| [airflow/cli/cli\_parser.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9jbGkvY2xpX3BhcnNlci5weQ==) | `98.13% <0.00%> (+0.93%)` | :arrow_up: |
| [...rflow/providers/databricks/operators/databricks.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZGF0YWJyaWNrcy9vcGVyYXRvcnMvZGF0YWJyaWNrcy5weQ==) | `92.24% <0.00%> (+1.72%)` | :arrow_up: |
| ... and [492 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r383512767
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
task/ti shouldn't be setting state in this manner but not sure what other option we have over here !
Would love to know opinions from other committers @potiuk @mik-laj @ashb @feluelle @BasPH
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r383511142
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
Review comment:
```suggestion
def create_branch_join_task(branch_operator, *args, **kwargs):
```
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io commented on issue #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **decrease** coverage by `33.10%`.
> The diff coverage is `72.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
===========================================
- Coverage 65.44% 32.33% -33.11%
===========================================
Files 927 928 +1
Lines 44963 44988 +25
===========================================
- Hits 29425 14546 -14879
- Misses 15538 30442 +14904
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `57.08% <ø> (-10.48%)` | :arrow_down: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `14.28% <0.00%> (-6.50%)` | :arrow_down: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/providers/microsoft/winrm/hooks/winrm.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L3dpbnJtL2hvb2tzL3dpbnJtLnB5) | `8.60% <0.00%> (-91.40%)` | :arrow_down: |
| [airflow/providers/oracle/hooks/oracle.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvb3JhY2xlL2hvb2tzL29yYWNsZS5weQ==) | `9.40% <0.00%> (-86.33%)` | :arrow_down: |
| [airflow/providers/apache/sqoop/hooks/sqoop.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL3Nxb29wL2hvb2tzL3Nxb29wLnB5) | `11.46% <0.00%> (-84.08%)` | :arrow_down: |
| [airflow/providers/apache/spark/hooks/spark\_jdbc.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL3NwYXJrL2hvb2tzL3NwYXJrX2pkYmMucHk=) | `10.34% <0.00%> (-81.61%)` | :arrow_down: |
| [airflow/providers/slack/hooks/slack\_webhook.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvc2xhY2svaG9va3Mvc2xhY2tfd2ViaG9vay5weQ==) | `16.66% <0.00%> (-79.17%)` | :arrow_down: |
| ... and [360 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 commented on issue #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-588086407
@TV4Fun as discussed, this is the new PR. Please close the old one. Thank you!
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r396590181
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
Sure I will take a look today, can you rebase on the latest master please to fix the Elasticsearch issue
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r389379398
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
Hi, @kaxil I've done the renaming you suggested to `create_branch_join_task()`.
Any suggestion about how to make `join_2` skipped other than raising `AirflowSkipException`?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **decrease** coverage by `32.76%`.
> The diff coverage is `72.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
===========================================
- Coverage 65.44% 32.68% -32.77%
===========================================
Files 927 928 +1
Lines 44963 44988 +25
===========================================
- Hits 29425 14703 -14722
- Misses 15538 30285 +14747
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `57.08% <ø> (-10.48%)` | :arrow_down: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `14.28% <0.00%> (-6.50%)` | :arrow_down: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/providers/microsoft/winrm/hooks/winrm.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L3dpbnJtL2hvb2tzL3dpbnJtLnB5) | `8.60% <0.00%> (-91.40%)` | :arrow_down: |
| [airflow/providers/oracle/hooks/oracle.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvb3JhY2xlL2hvb2tzL29yYWNsZS5weQ==) | `9.40% <0.00%> (-86.33%)` | :arrow_down: |
| [airflow/providers/apache/sqoop/hooks/sqoop.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL3Nxb29wL2hvb2tzL3Nxb29wLnB5) | `11.46% <0.00%> (-84.08%)` | :arrow_down: |
| [airflow/providers/apache/spark/hooks/spark\_jdbc.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL3NwYXJrL2hvb2tzL3NwYXJrX2pkYmMucHk=) | `10.34% <0.00%> (-81.61%)` | :arrow_down: |
| [airflow/providers/slack/hooks/slack\_webhook.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvc2xhY2svaG9va3Mvc2xhY2tfd2ViaG9vay5weQ==) | `16.66% <0.00%> (-79.17%)` | :arrow_down: |
| ... and [355 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r383601716
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
Thanks @kaxil. This is raising `AirflowSkipException` to cause the join task itself to be skipped. Please let me know if there are better ways to do this.
For other reviewers who haven't seen the previous discussion on the ancestor PR. What this `create_branch_join` does here is to make a join task like `join_2` in the following DAG. It makes sure the workflow can still work as we intuitively expect after the behaviour or `none_failed` is fixed by this PR. Logically, `join_2` should be skipped because its parent `BranchPythonOperator` `branch_2` has been skipped. Without `create_branch_join`, the `none_failed` task would actually become `success`.

----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 opened a new pull request #7464: [AIRFLOW-4453]
Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 opened a new pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464
This is to pick up the work started in https://github.com/apache/airflow/pull/7098. I discussed with @TV4Fun and opened this new PR to continue the work.
- Make behavior of `none_failed` consistent with documentation. Do not skip itself when all parents are skipped.
- Add `none_failed_or_skipped` which behaves like the old `none_failed` trigger rule (i.e. all parents are success or skipped and at least one parent is success). One use case of `none_failed_or_skipped` is the join task in a workflow with nested `BranchPythonOperator`
---
Issue link: [AIRFLOW-4453](https://issues.apache.org/jira/browse/AIRFLOW-4453)
Make sure to mark the boxes below before creating PR: [x]
- [x] Description above provides context of the change
- [x] Commit message/PR title starts with `[AIRFLOW-NNNN]`. AIRFLOW-NNNN = JIRA ID<sup>*</sup>
- [x] Unit tests coverage for changes (not needed for documentation changes)
- [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).
<sup>*</sup> For document-only changes commit message can start with `[AIRFLOW-XXXX]`.
---
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **increase** coverage by `21.44%`.
> The diff coverage is `96.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
===========================================
+ Coverage 65.44% 86.88% +21.44%
===========================================
Files 927 928 +1
Lines 44963 44988 +25
===========================================
+ Hits 29425 39087 +9662
+ Misses 15538 5901 -9637
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `95.68% <ø> (+28.13%)` | :arrow_up: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `94.04% <85.71%> (+73.26%)` | :arrow_up: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [airflow/providers/google/cloud/operators/vision.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZ29vZ2xlL2Nsb3VkL29wZXJhdG9ycy92aXNpb24ucHk=) | `99.63% <0.00%> (+0.36%)` | :arrow_up: |
| [...osoft/azure/operators/azure\_container\_instances.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvbWljcm9zb2Z0L2F6dXJlL29wZXJhdG9ycy9henVyZV9jb250YWluZXJfaW5zdGFuY2VzLnB5) | `78.28% <0.00%> (+0.65%)` | :arrow_up: |
| [airflow/cli/cli\_parser.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9jbGkvY2xpX3BhcnNlci5weQ==) | `98.13% <0.00%> (+0.93%)` | :arrow_up: |
| [...rflow/providers/databricks/operators/databricks.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvZGF0YWJyaWNrcy9vcGVyYXRvcnMvZGF0YWJyaWNrcy5weQ==) | `92.24% <0.00%> (+1.72%)` | :arrow_up: |
| ... and [492 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] yuqian90 commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
yuqian90 commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r396336689
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
@kaxil I have done the following. Could you take a second look? There are some elastic search related tests failing in Travis. Does not look related to my change.
1. Fixed "none_failed"
2. none_failed_or_skipped
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on issue #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-602930654
Can you rebase to latest master to fix the CI
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] codecov-io edited a comment on issue #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on issue #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#issuecomment-603575203
# [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=h1) Report
> Merging [#7464](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=desc) into [master](https://codecov.io/gh/apache/airflow/commit/a15026fa1652bec839a03d3e33eebac1b79545ae&el=desc) will **decrease** coverage by `0.72%`.
> The diff coverage is `72.00%`.
[](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #7464 +/- ##
==========================================
- Coverage 65.44% 64.71% -0.73%
==========================================
Files 927 928 +1
Lines 44963 44988 +25
==========================================
- Hits 29425 29113 -312
- Misses 15538 15875 +337
```
| [Impacted Files](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [airflow/example\_dags/example\_branch\_operator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9icmFuY2hfb3BlcmF0b3IucHk=) | `100.00% <ø> (ø)` | |
| [airflow/models/baseoperator.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9tb2RlbHMvYmFzZW9wZXJhdG9yLnB5) | `67.96% <ø> (+0.41%)` | :arrow_up: |
| [airflow/ti\_deps/deps/trigger\_rule\_dep.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy90aV9kZXBzL2RlcHMvdHJpZ2dlcl9ydWxlX2RlcC5weQ==) | `19.04% <0.00%> (-1.74%)` | :arrow_down: |
| [airflow/example\_dags/example\_nested\_branch\_dag.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9leGFtcGxlX2RhZ3MvZXhhbXBsZV9uZXN0ZWRfYnJhbmNoX2RhZy5weQ==) | `100.00% <100.00%> (ø)` | |
| [airflow/utils/trigger\_rule.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy91dGlscy90cmlnZ2VyX3J1bGUucHk=) | `100.00% <100.00%> (ø)` | |
| [...w/providers/apache/hive/operators/mysql\_to\_hive.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9wcm92aWRlcnMvYXBhY2hlL2hpdmUvb3BlcmF0b3JzL215c3FsX3RvX2hpdmUucHk=) | `35.84% <0.00%> (-64.16%)` | :arrow_down: |
| [airflow/kubernetes/pod\_launcher.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZF9sYXVuY2hlci5weQ==) | `28.16% <0.00%> (-58.46%)` | :arrow_down: |
| [airflow/kubernetes/volume\_mount.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZV9tb3VudC5weQ==) | `44.44% <0.00%> (-55.56%)` | :arrow_down: |
| [airflow/kubernetes/pod.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3BvZC5weQ==) | `42.50% <0.00%> (-50.00%)` | :arrow_down: |
| [airflow/kubernetes/volume.py](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree#diff-YWlyZmxvdy9rdWJlcm5ldGVzL3ZvbHVtZS5weQ==) | `52.94% <0.00%> (-47.06%)` | :arrow_down: |
| ... and [13 more](https://codecov.io/gh/apache/airflow/pull/7464/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=footer). Last update [a15026f...74f565d](https://codecov.io/gh/apache/airflow/pull/7464?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil merged pull request #7464: [AIRFLOW-4453] Make
behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil merged pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services
[GitHub] [airflow] kaxil commented on a change in pull request #7464:
[AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
Posted by GitBox <gi...@apache.org>.
kaxil commented on a change in pull request #7464: [AIRFLOW-4453] Make behavior of `none_failed` consistent with documentation
URL: https://github.com/apache/airflow/pull/7464#discussion_r391736305
##########
File path: airflow/operators/python.py
##########
@@ -167,6 +167,34 @@ def execute(self, context: Dict):
return branch
+def create_branch_join(branch_operator, *args, **kwargs):
+ """
+ Create a join task for a branching logic. This join task is always executed regardless
+ of which branches are followed. It is only skipped if the ``branch_operator`` is skipped.
+ """
+ def python_callable(ti, **_):
+ from airflow.utils.session import create_session
+ from airflow.exceptions import AirflowSkipException
+ from airflow.utils.state import State
+ from airflow.models import TaskInstance
+
+ with create_session() as session:
+ branch_ti = session.query(TaskInstance).filter(
+ TaskInstance.dag_id == ti.dag_id,
+ TaskInstance.task_id == branch_operator.task_id,
+ TaskInstance.execution_date == ti.execution_date
+ ).one_or_none()
+
+ if not branch_ti:
+ return
+
+ if branch_ti.state == State.SKIPPED:
+ raise AirflowSkipException(f"Skipping because parent task {branch_operator.task_id} "
+ "is skipped.")
Review comment:
WDYT?
----------------------------------------------------------------
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:
users@infra.apache.org
With regards,
Apache Git Services