Wake pending retries when capacity is released - #4293
Open
Hasnaathussain wants to merge 1 commit into
Open
Hasnaathussain wants to merge 1 commit into
Hasnaathussain wants to merge 1 commit into
Conversation
Signed-off-by: Hasnaat Hussain <hasnaat.hussain.2@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4246
When a capacity-starved run returns to
PENDING, the retry delay grows to a repeated 10-minute rung. A newer lower-priority run can then reach the submitted-job queue first and take a block that a longer-waiting run could use.This change marks pending retry runs for one immediate pass when a real instance releases a job, then wakes
RunPipeline. The pending worker consumes the existing one-pass signal and clears it after submitting or skipping the run. Normal exponential backoff remains unchanged when no capacity-release signal is present, and the pipeline's existing queue and worker limits still bound concurrent processing.The regression coverage checks the delayed retry path, the fetcher's one-pass flag handoff, and the real-instance unassignment wake-up. Placeholder deletion does not emit the unassignment event and does not trigger this path.
Validation:
uv run ruff checkuv run ruff format --checkuv run pre-commit run --files src/dstack/_internal/server/background/pipeline_tasks/jobs_terminating.py src/dstack/_internal/server/background/pipeline_tasks/runs/__init__.py src/dstack/_internal/server/background/pipeline_tasks/runs/pending.py src/tests/_internal/server/background/pipeline_tasks/test_runs/test_pending.py src/tests/_internal/server/background/pipeline_tasks/test_runs/test_pipeline.py src/tests/_internal/server/background/pipeline_tasks/test_terminating_jobs.pynpx --yes pyright --pythonpath .venv\\Scripts\\python.exeuv run pytest src/tests/_internal/server/background/pipeline_tasks/test_runs/test_pending.py -qunder WSL (9 passed, 9 skipped)uv run pytest src/tests/_internal/server/background/pipeline_tasks/test_runs/test_pipeline.py -qunder WSL (3 passed, 3 skipped)uv run pytest src/tests/_internal/server/background/pipeline_tasks/test_terminating_jobs.py -qunder WSL (27 passed, 27 skipped)