Skip to content

fix(scheduler): ignore queued stale success after defer - #67330

Closed
anmolxlight wants to merge 1 commit into
apache:mainfrom
anmolxlight:fix/67287-queued-defer-stale-success
Closed

fix(scheduler): ignore queued stale success after defer#67330
anmolxlight wants to merge 1 commit into
apache:mainfrom
anmolxlight:fix/67287-queued-defer-stale-success

Conversation

@anmolxlight

@anmolxlight anmolxlight commented May 22, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Extend the resume-after-defer stale executor success handling to cover TaskInstanceState.QUEUED in addition to SCHEDULED.
  • Parametrize the scheduler regression test so both scheduled and queued post-trigger states avoid the external-kill mismatch path when next_method is set.

Testing

  • uv run --project airflow-core pytest airflow-core/tests/unit/jobs/test_scheduler_job.py::TestSchedulerJob::test_process_executor_events_stale_success_when_rescheduled_after_defer -q --with-db-init
  • uv run prek run ruff --files airflow-core/src/airflow/jobs/scheduler_job_runner.py airflow-core/tests/unit/jobs/test_scheduler_job.py
  • uv run prek run ruff-format --files airflow-core/src/airflow/jobs/scheduler_job_runner.py airflow-core/tests/unit/jobs/test_scheduler_job.py

Closes #67287


Important

🛠️ Maintainer triage note for @anmolxlight · by @potiuk · 2026-07-02 22:14 UTC

I've removed the ready for maintainer review label because the next step here is yours:

  • This PR now has merge conflicts with main. Please rebase onto the latest main and resolve them.

The ball is in your court — you've been assigned. It'll return to the maintainer queue automatically once you rebase and mark it Ready for review — no need to re-add the label by hand.

Automated triage — may be imperfect; a maintainer takes the next look.

@anmolxlight
anmolxlight requested review from XD-DENG and ashb as code owners May 22, 2026 12:46
@boring-cyborg boring-cyborg Bot added the area:Scheduler including HA (high availability) scheduler label May 22, 2026
@potiuk potiuk added the ready for maintainer review Set after triaging when all criteria pass. label May 24, 2026
@potiuk
potiuk marked this pull request as draft July 2, 2026 18:44
@potiuk
potiuk marked this pull request as ready for review July 2, 2026 22:15
@potiuk potiuk removed the ready for maintainer review Set after triaging when all criteria pass. label Jul 2, 2026
@steveahnahn

Copy link
Copy Markdown
Contributor

Hey @anmolxlight, looks like the diagnosis is right and this exact fix already landed in #68741 (merged Jul 2), which also closed #67287. That PR makes the same change to the ti_requeued resume-after-defer guard in process_executor_events It accepts ti.state in (TaskInstanceState.SCHEDULED, TaskInstanceState.QUEUED) instead of TaskInstanceState.SCHEDULED only, and adds a dedicated regression test for the queued variant.

I believe this PR can be closed now!

@anmolxlight

Copy link
Copy Markdown
Contributor Author

Thanks @steveahnahn for catching that — confirmed that #68741 already addressed this. Closing this PR as superseded. 👋

@anmolxlight anmolxlight closed this Jul 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Scheduler including HA (high availability) scheduler

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Race condition between scheduler processing events and trigger completion — queued-state

3 participants