You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "MondeSinxi (via GitHub)" <gi...@apache.org> on 2023/11/30 11:10:52 UTC

[I] Documentation on trigger rule for `one_success` misleading [airflow]

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

   ### What do you see as an issue?
   
   https://airflow.apache.org/docs/apache-airflow/2.7.3/core-concepts/dags.html#trigger-rules
   
   The trigger rule for `one_success` states that " At least one upstream task has succeeded (does not wait for all upstream tasks to be done)". I believe that this should be changed to "At least one parent task has succeeded...". In the code snippet below I have a `task_f`, the trigger rule is set to `one_success`, I expect that once task `a` has succeeded (as on of the upstream tasks of `f`) then `f` should also run. However, the task is marked as `upstream_failed` as soon as task `c` fails. The expected behavior does not line up with the documentations.
   
   ```
   import time
   from datetime import datetime
   from airflow import DAG
   from airflow.operators.python import PythonOperator
   from airflow.utils.trigger_rule import TriggerRule
   
   
   def wait():
       time.sleep(3)
   
   
   def fail():
       raise Exception("I should fail!")
   
   
   with DAG("example", schedule=None, start_date=datetime(2023, 11, 30)) as dag:
       task_a = PythonOperator(task_id="a", python_callable=wait)
       task_b = PythonOperator(task_id="b", python_callable=wait)
       task_c = PythonOperator(task_id="c", python_callable=fail)
       task_d = PythonOperator(task_id="d", python_callable=wait)
       task_e = PythonOperator(task_id="e", python_callable=wait)
       task_f = PythonOperator(task_id="f", python_callable=wait, trigger_rule=TriggerRule.ONE_SUCCESS)
   
       task_a >> task_b >>  task_c >> task_d >> task_f
   
       task_c >> task_e >> task_f
   ```
   
   ![image](https://github.com/apache/airflow/assets/30410358/bae71952-c0fe-42db-a889-a6036b3fbc2c)
   
   
   
   ### Solving the problem
   
   I believe that this should be changed to "At least one parent task has succeeded...".
   
   ### 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: commits-unsubscribe@airflow.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Documentation on trigger rule for `one_success` misleading [airflow]

Posted by "boring-cyborg[bot] (via GitHub)" <gi...@apache.org>.
boring-cyborg[bot] commented on issue #35974:
URL: https://github.com/apache/airflow/issues/35974#issuecomment-1833550712

   Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.
   


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Documentation on trigger rule for `one_success` misleading [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal commented on issue #35974:
URL: https://github.com/apache/airflow/issues/35974#issuecomment-1837210762

   trigger rules check only **direct** upstream. Task `f` trigger rule will not check tasks `c, b`


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] Documentation on trigger rule for `one_success` misleading [airflow]

Posted by "eladkal (via GitHub)" <gi...@apache.org>.
eladkal closed issue #35974: Documentation on trigger rule for `one_success` misleading
URL: https://github.com/apache/airflow/issues/35974


-- 
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: commits-unsubscribe@airflow.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org