@Extension(optional=true) public class BuildBlockerQueueTaskDispatcher extends QueueTaskDispatcher
ExtensionPoint.LegacyInstancesAreScopedToHudson
Constructor and Description |
---|
BuildBlockerQueueTaskDispatcher() |
Modifier and Type | Method and Description |
---|---|
CauseOfBlockage |
canRun(Queue.Item item)
Called whenever
Queue is considering if Queue.Item is ready to
execute immediately
(which doesn't necessarily mean that it gets executed right away — it's still subject to
executor availability), or if it should be considered blocked. |
CauseOfBlockage |
canTake(Node node,
Queue.BuildableItem item) |
all, canTake
public CauseOfBlockage canRun(Queue.Item item)
Called whenever Queue
is considering if Queue.Item
is ready to
execute immediately
(which doesn't necessarily mean that it gets executed right away — it's still subject to
executor availability), or if it should be considered blocked.
Compared to canTake(hudson.model.Node, hudson.model.Queue.BuildableItem)
, this version tells Jenkins
that the task is
simply not ready to execute, even if there's available executor. This is more efficient
than canTake(hudson.model.Node, hudson.model.Queue.BuildableItem)
, and it sends the right signal to
Jenkins so that
it won't use Cloud
to try to provision new executors.
Vetos are additive. When multiple QueueTaskDispatcher
s are in the system,
the task is considered blocked if any one of them returns a non-null value.
(This relationship is also the same with built-in check logic.)
If a QueueTaskDispatcher
returns non-null from this method, the task is placed into
the 'blocked' state, and generally speaking it stays in this state for a few seconds before
its state gets re-evaluated. If a QueueTaskDispatcher
wants the blockage condition
to be re-evaluated earlier, call Queue.scheduleMaintenance()
to initiate that process.
canRun
in class QueueTaskDispatcher
QueueTaskDispatcher
is concerned. Otherwise return an object that indicates why
the build is blocked.public CauseOfBlockage canTake(Node node, Queue.BuildableItem item)
canTake
in class QueueTaskDispatcher
Copyright © 2016–2023. All rights reserved.