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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]