Repository navigation
feat(queue): berth queue lets the operator bump, re-rank or drop a waiter - #324
Merged
Merged
Conversation
…iter Berth grants waiters by priority, then arrival, so many devices can send work to one card with nobody sorting it. berth queue is for when the operator wants a different order. With no arguments it lists the waiters in grant order with their lease IDs. bump moves one to the front of its priority class (a bumpedN tiebreak in sortQueue, latest bump first), prio moves it to batch, interactive or foreground, and drop refuses it the way the training lock does. A hold or a training cannot be changed here. Each change is a lease.queue_override event. A new OpQueue goes through the node to every card the waiter waits on.
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.
Why
Berth Next milestone 7b, operator override. The operator's rule is priority first, then first come first served,
"unless the operator changes it". Until now there was no way to change it. This PR adds that, and nothing about
the default order changes.
What changes
Broker.Queue(id, action, prio)with three actions:bumpsets a newbumpedNfrom the broker's order counter.sortQueuenow orders by priority, then thelatest bump, then arrival.
priomoves the waiter to batch, interactive or foreground. It refuses hold, because a hold is a pin, and itrefuses a training, because the lock fixes its place.
droprefuses the waiter throughlockCh, the same path the training lock uses.lease.queue_overridewith a reason like "priority batch -> foreground by the operator".OpQueuegoes throughnode.Queueto every card the waiter waits on (a multi-card lease shares one ID). Throughserver.queueit is reachable only on the 0600 socket. The harbor buttons come later, behind pairing.berth queue [bump ID | prio ID CLASS | drop ID]. With no arguments it lists POS, ID, ENGINE, PRIORITY andWAITING in grant order. An older berthd answers
unknown op "queue".docs/leasing.md, plus the CLI list, the agent skill (the commands arethe operator's to use, not an agent's) and the CHANGELOG.
Proof
TestQueueOverride(broker) starts with the queue a, bb, c. Afterbump bbit is bb, a, c. Afterprio c foregroundit is c, bb, a.drop arefuses a with the operator's reason. It also checks that the three eventsname each change and that the next grant follows the new order. With the bump tiebreak removed it fails
(
after bump bb: [a bb c]).TestQueueAgainstADaemon(CLI) runs a real berthd with a pinned holder and two waiters on the real socket. Itcovers the JSON and human lists, bump, drop, a refused
prio ... hold, and an unknown ID.proof.shfull passes.