You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "darenpang (via GitHub)" <gi...@apache.org> on 2024/12/30 15:32:02 UTC

[I] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   ### Apache Airflow version
   
   Other Airflow 2 version (please specify below)
   
   ### If "Other Airflow 2 version" selected, which one?
   
   2.10.1
   
   ### What happened?
   
   I have a DAG with three tasks in sequence:
   
   wait_for_3am (a DateTimeSensorAsync), which waits until 3:00 AM and thus remains in deferred state until the target time.
   empty_task_1 (an EmptyOperator), which depends on wait_for_3am.
   empty_task_2 (another EmptyOperator), which depends on empty_task_1.
   All tasks inherit the default trigger rule of none_failed. According to the documentation for none_failed, all upstream tasks must have “not failed or upstream_failed” (i.e. they should have succeeded or been skipped) in order to trigger the downstream tasks.
   
   However, if I manually mark empty_task_1 as success while wait_for_3am is still in the deferred state (i.e., it has neither failed nor succeeded yet), then empty_task_2 immediately runs. From a scheduler standpoint, empty_task_2 sees empty_task_1 = success and therefore proceeds under none_failed, even though wait_for_3am has not actually completed.
   
   ### What you think should happen instead?
   
   I expected that if an upstream sensor (wait_for_3am) is still in a non-terminal (deferred) state, marking empty_task_1 as success would not trigger empty_task_2 immediately .
   
   ### How to reproduce
   
   Try this DAG, mark empty_task_1 as success .
   
   ```
   from datetime import datetime, timedelta
   from airflow import DAG
   from airflow.utils.trigger_rule import TriggerRule
   from airflow.sensors.date_time import DateTimeSensorAsync
   from airflow.operators.empty import EmptyOperator
   
   default_args = {
       'owner': 'airflow',
       "trigger_rule": TriggerRule.NONE_FAILED,
   }
   
   with DAG(
       'simple_dag_with_datetime_sensor',
       default_args=default_args,
       description='A simple DAG with DateTimeSensorAsync and two EmptyOperators',
       schedule_interval=timedelta(days=1),
       start_date=datetime(2024, 12, 30),
       catchup=False,
       max_active_runs=1,
   ) as dag:
   
       wait_for_3am = DateTimeSensorAsync(
           task_id='wait_for_3am',
           target_time=datetime.combine(datetime.today(), datetime.min.time()) + timedelta(hours=3),
       )
   
       empty_task_1 = EmptyOperator(
           task_id='empty_task_1',
       )
   
       empty_task_2 = EmptyOperator(
           task_id='empty_task_2',
       )
   
       wait_for_3am >> empty_task_1 >> empty_task_2
   ```
   
   ### Operating System
   
   RHEL8
   
   ### Versions of Apache Airflow Providers
   
   _No response_
   
   ### Deployment
   
   Virtualenv installation
   
   ### 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: commits-unsubscribe@airflow.apache.org.apache.org

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


Re: [I] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   Correct. That's expected.


-- 
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] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   @RNHTTR 
   Would you please confirm the intended behavior?
   


-- 
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] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   Assigned you @darenpang 


-- 
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] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   @RNHTTR 
   
   I would be happy to open a PR to improve the documentation if the maintainers confirm the intended behavior.


-- 
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] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

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

   @RNHTTR 
   I’ve found this in the document.
   
   > By default, Airflow will wait for all upstream (direct parents) tasks for a task to be [successful](https://airflow.apache.org/docs/apache-airflow/2.10.1/core-concepts/tasks.html#concepts-task-states) before it runs that task.
   
   So Airflow does not recursively check grandparent tasks. It only looks to see if all direct parents are not failed. So this behavior is expected and consistent with the documentation.
   If you confirm this , maybe this issue should be closed . 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.

To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org

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


Re: [I] Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior) [airflow]

Posted by "potiuk (via GitHub)" <gi...@apache.org>.
potiuk closed issue #45292: Manual success of a mid-pipeline task triggers its downstream even though an upstream sensor is still deferred (question about none_failed behavior)
URL: https://github.com/apache/airflow/issues/45292


-- 
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