olk opened a new issue, #46297:
URL: https://github.com/apache/airflow/issues/46297
### Apache Airflow version
2.10.4
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
The joning task after branching is always skipped with trigger
policy="none_failed_min_one_success":
```
from airflow.utils.dates import days_ago
from airflow.decorators import dag, task, task_group
@task
def start():
return [ 1, 2, 3 ]
@task_group
def expanding(n):
@task.branch
def branching(n):
print(n)
if n == 1:
return "expanding.foo"
else:
return "expanding.bar"
@task
def foo(n):
print(n)
return n + 1
@task
def bar(n):
print(n)
return n + 3
@task(trigger_rule='none_failed_min_one_success')
def finalize(x, y):
if x is not None:
return x
if y is not None:
return y
return None
choose_tech_branch_result = branching(n)
foo_result = foo(n)
bar_result = bar(n)
choose_tech_branch_result >> [ foo_result, bar_result ]
finalize_result = finalize(foo_result, bar_result)
[ foo_result, bar_result ] >> finalize_result
return finalize_result
@task
def finalize_all(group_results):
print(group_results)
return group_results
@dag(dag_id="branching",
start_date=days_ago(1),
schedule_interval=None)
def branch_example():
group_results = expanding.expand(n=start())
finalizer_result = finalize_all(group_results)
print(finalizer_result)
branch_example()
```
Workaround: pass argument `n` to task ´finalize` even if it's not used.
seams to be an issue with upstream evaluation.
```
from airflow.utils.dates import days_ago
from airflow.decorators import dag, task, task_group
@task
def start():
return [ 1, 2, 3 ]
@task_group
def expanding(n):
@task.branch
def branching(n):
print(n)
if n == 1:
return "expanding.foo"
else:
return "expanding.bar"
@task
def foo(n):
print(n)
return n + 1
@task
def bar(n):
print(n)
return n + 3
@task(trigger_rule='none_failed_min_one_success')
def finalize(_, x, y):
if x is not None:
return x
if y is not None:
return y
return None
choose_tech_branch_result = branching(n)
foo_result = foo(n)
bar_result = bar(n)
choose_tech_branch_result >> [ foo_result, bar_result ]
finalize_result = finalize(n, foo_result, bar_result)
[ foo_result, bar_result ] >> finalize_result
return finalize_result
@task
def finalize_all(group_results):
print(group_results)
return group_results
@dag(dag_id="branching",
start_date=days_ago(1),
schedule_interval=None)
def branch_example():
group_results = expanding.expand(n=start())
finalizer_result = finalize_all(group_results)
print(finalizer_result)
branch_example()
```
### What you think should happen instead?
_No response_
### How to reproduce
see comment/code
### Operating System
Linux
### Versions of Apache Airflow Providers
_No response_
### Deployment
Official Apache Airflow Helm Chart
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]