The GitHub Actions job "Tests (AMD)" on 
airflow.git/fix/reschedule-start-date-multi-scheduler has failed.
Run started by GitHub user 1fanwang (triggered by 1fanwang).

Head commit for run:
b158ba05ad0986a7ad41cf0e74396e35e978537c / 1fanwang <[email protected]>
Preserve sensor start_date across reschedule pokes

When a sensor runs in mode="reschedule", the supervisor sends
start_date=utcnow() on every poke. The ti_run execution-API endpoint
wrote that value through unconditionally, so ti.start_date drifted
forward on each re-execution. dagrun.first_task_scheduling_delay
(computed from start_date - queued_at) collapsed to ~0 for any DAG
fronted by a reschedule-mode sensor.

Add a reschedule guard in ti_run that mirrors the existing
deferral guard: when start_date is present in the payload and the task
has prior TaskReschedule rows, restore start_date from the first row
instead of accepting the supervisor's utcnow(). The lookup is scoped by
ti_id, and prepare_db_for_next_try clears TaskReschedule rows and
rotates ti.id on each retry, so try-number scoping is implicit and no
stale rows leak across tries. Also mirror context.start_date in the
response so the supervisor pins context["ti"].start_date to the first
poke as well.

Also drop the unreliable state guard on the same path in
_check_and_change_state_before_execution. In the normal multi-scheduler
flow the scheduler advances UP_FOR_RESCHEDULE -> QUEUED before the
worker calls this method, so refresh_from_db returns QUEUED and the
guard never fires. The TaskReschedule lookup is harmless for
non-rescheduled tasks (returns no rows), so the guard can go.

Closes #66784

Signed-off-by: 1fanwang <[email protected]>

Report URL: https://github.com/apache/airflow/actions/runs/25745483795

With regards,
GitHub Actions via GitBox


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to