Repository navigation
Conversation
An orphaned scaleset never drained when GARM reported one of its runners as running a job: `_remove_runners` skipped that runner on every pass, whatever the drain's age, so the scaleset, its template and its provider stayed behind forever while the charm logged the same line every five minutes. Past DRAIN_DEADLINE the record cannot describe a job that is still running — a self-hosted job cannot outlive MAX_JOB_RUNTIME, and the deadline is that plus a margin — so the completion that would have cleared the runner was lost. The busy protection is now time-bounded: past the deadline the runner is removed with the existing escalation (a plain delete, forcing only when GARM is already sitting on a delete it could not carry out), and before it the runner is left alone exactly as now. `_advance_retirement` already only calls `_remove_runners(past_deadline=True)` once `_drain_deadline_passed()` is true, so the retirement path inherits the same rule rather than deleting a busy runner early. Also documents, at `_drain_deadline_passed`, why re-disabling a scaleset does not reset the clock: GARM's `updateScaleSet` writes only the fields that differ and issues no statement when none do, so an idempotent disable leaves `updated_at` at the moment it was first disabled. Refs: ISD-7263
yanksyoon
marked this pull request as ready for review
October 23, 2026 04:05
yanksyoon
requested review from
cbartz,
florentianayuwono,
javierdelapuente,
weiiwang01 and
yhaliaw
as code owners
October 23, 2026 04:05
florentianayuwono
approved these changes
Oct 23, 2026
yanksyoon
marked this pull request as draft
October 23, 2026 06:11
Member
Author
|
I'm going to think a bit more about this. I think our fundamental design of the reconciliation can be improved. The data flow isn't so straightforward. |
This branch has not been deployed
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.
Summary
Fixes ISD-7263. An orphaned scale set never drained when GARM reported one of its runners as running a job: the charm skipped that runner on every pass regardless of the drain's age, so the scale set, its template and its provider stayed behind forever.
Faulty vs fixed
Notes
_delete_runnerforces only when GARM already accepted a delete it could not carry out; forcing a busy runner would drop the record while the VM may still exist._advance_retirementalready calls_remove_runners(past_deadline=True)only after_drain_deadline_passed()is true, so the retirement path inherits the same rule rather than deleting a busy runner early._drain_deadline_passed()stays onupdated_at, and its docstring now records why that clock is sound: GARM'supdateScaleSetwrites only the fields that differ and issues no statement when none do, so the idempotent re-disable on every sweep leavesupdated_atat the disable moment.Tests
test_drain_past_the_deadline_removes_a_runner_still_marked_busy— past the deadline the busy runner getsdelete_instance("runner-1", force=False, ...)and the scale set is deleted on a later pass.test_drain_within_the_deadline_leaves_a_runner_marked_busy_alone— inside the deadline nothing is deleted, which is the reason the deadline exists.CCR001and codespell clean on the touched files.Not in this PR
deleted) runner past the deadline is still reported on every pass rather than once. Deduping it needs per-scale-set state the charm does not keep, so it is left for a follow-up, together with therecover-scalesetaction from the ticket.