Repository navigation
feat(broker): a training keeps its lock while berthd is away - #317
Merged
Merged
Conversation
A berth train run records itself as a training when it loses berthd. With berthd down, berth run refuses to start an engine while a live training record exists, instead of starting it without a lease. A berthd that starts while a training runs treats its record as the lock: it refuses every other request until the training re-attaches, with no time limit, where other engines get the 15 second re-attach window.
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.
What
A
berth trainrun keeps its lock while berthd is away.berth runrefuses to start an engine while a training runs on the node. Before, it startedthe engine without a lease, beside the training.
time limit. Other engines still get the 15 second re-attach window.
Why
#314 made a training lock its cards while berthd runs. A berthd crash, restart or upgrade opened a gap: an engine
started in that time ran unprotected beside the training, and a training that re-attached after the window found
other work granted on its card.
How
runs.RecordgainsTraining. The runner sets it when a training records that it lost berthd.runs.Trainingfinds a live training record. The runner checks it before it starts an engine unprotected.dueToReattachdrops the window for a training record.lockedBynames a training lease or a training recordnot yet re-attached, and
refuseuses it, so other requests are refused at once instead of held.Proof
.claude/skills/berth-verify/proof.sh: full proof OK.TestTrainingLocksTheCardUntilItReattachesfails with the old window rule and passes with the change.TestTrainingRecordLocksOnlyWhileItsProcessLives,TestTrainingIsALiveTrainingRecordandTestRunRefusesWithoutADaemonWhileATrainingRuns(a realberth runwith no berthd and a live training record:refused, command never started) cover the rest.