feat: drain run backlog back-to-back with a job capacity guard#42
Open
tfelix wants to merge 1 commit into
Open
feat: drain run backlog back-to-back with a job capacity guard#42tfelix wants to merge 1 commit into
tfelix wants to merge 1 commit into
Conversation
The run-controller previously created at most one job per polling interval, so a backlog of runs drained at 1 run / interval. It also had no concurrency limit: it would claim a run, fail job creation when the namespace was full, and report the run as FAILED. Process queued runs back-to-back each polling cycle until the backlog is empty, and gate fetching on a best-effort capacity check so we only claim runs we are fairly sure we can place: - Add maxConcurrentJobs config (default 20; negative = unlimited). - Count unfinished runner jobs (CountActiveJobs) and drain only up to the remaining budget; skip the cycle when at capacity or when the count cannot be determined. - processNextRun now returns a result so the drain loop knows when to stop (no run, capacity reached, or failure). - Add run_controller_jobs_at_capacity_skips_total metric. - Introduce JobManager interface to unit-test the control flow; add tests for draining, capacity limits, and availableCapacity branches.
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.
The run-controller previously created at most one job per polling interval, so a backlog of runs drained at 1 run / interval. It also had no concurrency limit: it would claim a run, fail job creation when the namespace was full, and report the run as FAILED.
Process queued runs back-to-back each polling cycle until the backlog is empty, and gate fetching on a best-effort capacity check so we only claim runs we are fairly sure we can place: