ashutosh264 opened a new pull request, #68820: URL: https://github.com/apache/airflow/pull/68820
When the scheduler's stuck-in-queued handler runs, it can still reschedule a task instance whose worker has already picked it up. That race shows up with deferrable operators: a task moves through queued → running → deferred, but a stale queued row with an expired queued_dttm gets reset to scheduled and can resume or succeed too early. This change refreshes each candidate task instance before handling it, and skips stuck-in-queued reschedule when the state is no longer queued, or when a running log entry exists for the current try at or after the current queued_dttm. Closes: #65248 Test plan (in case reviewers need it): `uv run --project airflow-core pytest airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_handle_stuck_queued_skips_when_queue_attempt_started -xvs` -- 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]
