Class AgentRecycler
An agent is looked at soon after a run that was counted on it ends, and all of them every minute. An agent that is not online, or was taken offline by someone else, is left alone. A recycle that does not work is tried again later, further and further apart, and the agent is left at its limit meanwhile.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classAn agent that has used all its builds and comes online, as one does after a restart, is looked at at once.static final classLooks at all the agents once in a while: the end of a run is not the only way for an agent to become free. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanStarts recycling the agent if it is due, and says whether it did.static AgentRecyclerget()static voididleActionDone(String node, AgentUsageRegistry.RecycleOutcome outcome) What is done to the machine of an agent when it is disconnected is over (or went wrong).static booleanisAwaitingDisconnect(String node) Whether the agent is being recycled by a disconnect that has not said yet how it went.static booleanisRecycling(String node) Whether the recycle of the agent has not ended.voidscheduleCheck(String node) Looks at the agent soon: it may have just become free.voidsetCheckDelayMs(long checkDelayMs) For tests only.voidsetClock(LongSupplier clock) For tests only.Looks at every vSphere agent and starts recycling those that are due.
-
Constructor Details
-
AgentRecycler
public AgentRecycler()
-
-
Method Details
-
get
-
setClock
For tests only. -
setCheckDelayMs
public void setCheckDelayMs(long checkDelayMs) For tests only. -
scheduleCheck
Looks at the agent soon: it may have just become free. -
sweepOnce
Looks at every vSphere agent and starts recycling those that are due. Returns their names. -
check
Starts recycling the agent if it is due, and says whether it did. The recycling itself is done on another thread.The agent is marked offline here, once it is known to be free, and not when it reaches its limit. Until then
UsageGatekeeps new work away from it and lets through what a run counted on it needs, such as the nextnode {}blocks of a Pipeline; the queue does not offer work to an offline agent, so the run would wait for an agent that waits for the run to end. Every change of the mark also saves the configuration of the node. From the moment the recycle is taken (under the lock of the queue)UsageGaterefuses everything, so the agent is not offered work in the time before it is marked. -
isRecycling
Whether the recycle of the agent has not ended. -
isAwaitingDisconnect
Whether the agent is being recycled by a disconnect that has not said yet how it went. -
idleActionDone
What is done to the machine of an agent when it is disconnected is over (or went wrong). Said by the launcher every time it disconnects, which can be more than once: only what comes while an agent is being recycled counts.
-