Repository navigation
Per-plug lock, so two jobs cannot switch a plug at once - #10
Merged
Merged
Conversation
Two jobs sharing a bench plug could cycle it at once, or cycle it in the middle of each other's test run.
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.
Two jobs sharing a bench plug could switch it at the same time, or cycle it in the middle of the other's test run.
on,offandcycletake the plug's lock (an OS file lock per MAC, released when the process ends, even on a crash). When it is held they fail with "plug bench is locked by since ", or wait with--wait-lock 5m.--holder/PLUGCTL_HOLDERnames the holder; the default is the pid and host.plugctl lock <plug> -- <command>holds the lock while the command runs and exits with its status. plugctl calls inside it switch as usual (the MAC is passed down inPLUGCTL_HELD_LOCKS).state --jsongainson_since./config/locks.Locks cover one machine (or containers sharing
/config); they do not coordinate two machines.Library:
Locks,PlugLock,Connected::lock,Controller::with_locks/with_lock_wait, andError::Locked. AConnectednow holds the lock from its first switch until it is dropped.Tested: unit tests for refusal, waiting and the held-by-parent list, and a controller test that a locked plug is not switched. On a real plug that was already on:
oninsidelocksucceeds, a second job is refused with the holder's name,--wait-lockwaits it out, and the exit status passes through.