Skip to content

Ensure stuck ti is in the queued state before revoking #50061

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

karenbraganz
Copy link
Collaborator

@karenbraganz karenbraganz commented May 1, 2025

This PR modifies the logic to requeue tasks stuck in the queued state. It ensures that the task is still in the queued state before revoking it from the executor and requeueing. This avoids the race condition where the task has already started running.


^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

@boring-cyborg boring-cyborg bot added the area:Scheduler including HA (high availability) scheduler label May 1, 2025
@karenbraganz
Copy link
Collaborator Author

For testing- I deliberately got tasks stuck in the queued state to ensure this code wouldn't break anything. This change did not affect the way stuck tasks are revoked or requeued if they are still in the queued state.

I am not sure yet how to reproduce the race condition to ensure that the task will not be requeued if it enters the running state just before.

@karenbraganz
Copy link
Collaborator Author

I have added a unit test to test that a running task will not be requeued.

@karenbraganz
Copy link
Collaborator Author

This resolves issue #49889

@karenbraganz karenbraganz marked this pull request as ready for review May 1, 2025 14:04
@karenbraganz karenbraganz requested review from ashb and XD-DENG as code owners May 1, 2025 14:04
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.

2 participants