jmelot opened a new issue, #50210:
URL: https://github.com/apache/airflow/issues/50210

   ### Apache Airflow version
   
   2.10.5
   
   ### If "Other Airflow 2 version" selected, which one?
   
   _No response_
   
   ### What happened?
   
   We have a dynamically generated task inside a task group with trigger rule 
`ONE_FAILED` and an upstream task that fails in some cases and succeeds in 
others. We find that if one instance of the upstream task fails and others 
succeed, the task task with trigger rule `ONE_FAILED` is marked success in all 
instances rather than being skipped in some and marked success in others.
   
   ### What you think should happen instead?
   
   I would expect this task to be marked skipped when no upstream task fails.
   
   ### How to reproduce
   
   I made this simple dag to demonstrate the behavior we are seeing
   
   ```
   import logging
   
   from airflow.decorators import task, task_group
   from airflow.decorators import dag
   from airflow.utils.trigger_rule import TriggerRule
   
   
   logger = logging.getLogger(__name__)
   
   @task
   def divide(i):
       return 30/i
   
   @task(trigger_rule=TriggerRule.ONE_FAILED)
   def report_failure(i):
       logger.info(f"{i} failed")
   
   @task
   def report_success(i):
       logger.info(f"{i} succeeded")
   
   @dag(
       dag_id="Test-Trigger-Rule",
       schedule=None,
       catchup=False,
   )
   def test_trigger_rule_dag():
       @task
       def gen_examples():
           return [0,1,2,3]
       
       @task_group
       def divide_and_report(i):
           divide(i) >> [report_success(i), report_failure(i)]
           
       divide_and_report.expand(i=gen_examples())
   
   test_trigger_rule_dag()
   ```
   
   When I run this dag, `report_success` behaves as I would expect, with three 
mapped tasks in `success` and one in `upstream_failed`. `report_failure` is 
always marked success, however, rather than three tasks being marked `skipped` 
and one `success`.
   
   <img width="1353" alt="Image" 
src="https://github.com/user-attachments/assets/75169904-75b4-43b7-9a0b-ffe44cd18efa";
 />
   
   <img width="1342" alt="Image" 
src="https://github.com/user-attachments/assets/7cb0b669-a12b-41f2-a5de-3e4e51580367";
 />
   
   If this is a bug I'm happy to do what I can to help fix it. If I've 
misunderstood something and this behavior is actually expected, I'm happy to 
help update documentation if needed so others aren't confused.
   
   ### Operating System
   
   macOS 15.4.1
   
   ### 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?
   
   - [x] 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]

Reply via email to