Sensor start_date gets updated for the same try in reschedule mode #15645
Open
Description
Apache Airflow version: 2.0.0
What happened:
Sensor start_date gets updated to each time the task instance is rescheduled for the same try.
What you expected to happen:
I expect the start_date
of a sensor task instance to remain the same within a given try. The start_date
should be the start of first poke instead of the start time of the following rescheduled attempts.
This behaviour does not match the description in the source code.
# Set the task start date. In case it was re-scheduled use the initial # start date that is recorded in task_reschedule table
Airflow did behave as expected in 1.10.x but it stopped in 2.0+.
How to reproduce it:
Run any sensors and watch the start_date value change at after each retry.
with DAG(
dag_id="check_dag",
start_date=datetime(2021, 1, 1),
schedule_interval='@daily',
catchup=False,
) as dag:
p = ExternalTaskSensor(
task_id='sensor_task',
external_dag_id='my_dag',
mode='reschedule'
)