Enforce max_duration on the server - #4273
Open
un-def wants to merge 1 commit into
Open
Conversation
Previously, `max_duration` was enforced only by the runner, which cancels the job context once the deadline passes. When that failed to stop the workload, nothing else did: a RUNNING job has no server-side liveness bound, and the runner keeps answering `/api/pull` with the job still running. Now the server enforces the deadline as well, without depending on the runner being healthy. `JobModel.running_at` records when the job entered RUNNING, and a job still running that long plus `max_duration` and `MAX_DURATION_ENFORCEMENT_GRACE` is terminated with `MAX_DURATION_EXCEEDED`. The grace period keeps the runner primary, since it stops the job gracefully and reports a more accurate state, and lets the server act only when the runner did not. Jobs whose `running_at` is unset -- those already running when the server is upgraded -- are left to the runner. Fixes: #4259
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.
Previously,
max_durationwas enforced only by the runner, which cancels the job context once the deadline passes. When that failed to stop the workload, nothing else did: a RUNNING job has no server-side liveness bound, and the runner keeps answering/api/pullwith the job still running.Now the server enforces the deadline as well, without depending on the runner being healthy.
JobModel.running_atrecords when the job entered RUNNING, and a job still running that long plusmax_durationandMAX_DURATION_ENFORCEMENT_GRACEis terminated withMAX_DURATION_EXCEEDED.The grace period keeps the runner primary, since it stops the job gracefully and reports a more accurate state, and lets the server act only when the runner did not.
Jobs whose
running_atis unset -- those already running when the server is upgraded -- are left to the runner.Fixes: #4259