Interface Queue.Task
- All Superinterfaces:
ITask
,ModelObject
,ResourceActivity
,SubTask
- All Known Subinterfaces:
BuildableItem
,BuildableItemWithBuildWrappers
,ParameterizedJobMixIn.ParameterizedJob<JobT,
,RunT> Queue.FlyweightTask
,Queue.NonBlockingTask
,Queue.TransientTask
,SCMedItem
- All Known Implementing Classes:
AbstractProject
,AbstractQueueTask
,FreeStyleProject
,Project
,QueueTaskFilter
- Enclosing class:
- Queue
Value equality
of Queue.Task
s is used
to collapse two tasks into one. This is used to avoid infinite
queue backlog.
Pending Queue.Task
s are persisted when Hudson shuts down, so
it needs to be persistable via XStream. To create a non-persisted
transient Task, extend Queue.TransientTask
marker interface.
Plugins are encouraged to implement AccessControlled
otherwise
the tasks will be hidden from display in the queue.
For historical reasons, Queue.Task
object by itself
also represents the "primary" sub-task (and as implied by this
design, a Queue.Task
must have at least one sub-task.)
Most of the time, the primary subtask is the only sub task.
-
Method Summary
Modifier and TypeMethodDescriptiondefault void
Checks the permission to see if the current user can abort this executable.default String
Returns task-specific key which is used by theLoadBalancer
to choose one particular executor amongst all the free executors on all possibly suitable nodes.default CauseOfBlockage
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.default Authentication
Deprecated.default Authentication
Deprecated.default org.springframework.security.core.Authentication
This method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticator
fails to authenticate the build.default org.springframework.security.core.Authentication
This method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticator
fails to authenticate the build.getName()
Unique name of this task.default Collection<? extends SubTask>
Obtains theSubTask
s that constitute this task.getUrl()
Returns the URL of this task relative to the context root of the application.default String
Deprecated.as of 1.330 UseCauseOfBlockage.getShortDescription()
instead.default boolean
Deprecated.UsegetCauseOfBlockage()
!= nulldefault boolean
True if the task allows concurrent builds, where the sameQueue.Task
is executed by multiple executors concurrently on the same or different nodes.Methods inherited from interface jenkins.model.queue.ITask
hasAbortPermission, hasReadPermission
Methods inherited from interface hudson.model.ModelObject
getDisplayName
Methods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceList
Methods inherited from interface hudson.model.queue.SubTask
createExecutable, getAssignedLabel, getEstimatedDuration, getLastBuiltOn, getOwnerExecutable, getOwnerTask, getSameNodeConstraint
-
Method Details
-
isBuildBlocked
Deprecated.UsegetCauseOfBlockage()
!= nullReturns true if the execution should be blocked for temporary reasons. -
getWhyBlocked
Deprecated.as of 1.330 UseCauseOfBlockage.getShortDescription()
instead. -
getCauseOfBlockage
If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.Otherwise this method returns null, indicating that the build can proceed right away.
This can be used to define mutual exclusion that goes beyond
ResourceActivity.getResourceList()
.- Returns:
- by default, null
-
getName
String getName()Unique name of this task.This method is no longer used, left here for compatibility. Just return
ModelObject.getDisplayName()
. -
getFullDisplayName
String getFullDisplayName()- Specified by:
getFullDisplayName
in interfaceITask
- Returns:
- the full display name of the task.
Defaults to the same as
ModelObject.getDisplayName()
. - See Also:
-
getAffinityKey
Returns task-specific key which is used by theLoadBalancer
to choose one particular executor amongst all the free executors on all possibly suitable nodes. NOTE: To be able to re-use the same node during the next run this key should not change from one run to another. You probably want to compute that key based on the job's name.- Returns:
- by default:
getFullDisplayName()
- See Also:
-
checkAbortPermission
default void checkAbortPermission()Checks the permission to see if the current user can abort this executable. Returns normally from this method if it's OK.NOTE: If you have implemented
AccessControlled
this defaults tocheckPermission(hudson.model.Item.CANCEL);
- Throws:
org.springframework.security.access.AccessDeniedException
- if the permission is not granted.
-
getUrl
String getUrl()Returns the URL of this task relative to the context root of the application.When the user clicks an item in the queue, this is the page where the user is taken to. Hudson expects the current instance to be bound to the URL returned by this method.
-
isConcurrentBuild
default boolean isConcurrentBuild()True if the task allows concurrent builds, where the sameQueue.Task
is executed by multiple executors concurrently on the same or different nodes.- Returns:
- by default, false
- Since:
- 1.338
-
getSubTasks
Obtains theSubTask
s that constitute this task.The collection returned by this method must also contain the primary
SubTask
represented by thisQueue.Task
object itself as the first element. The returned value is read-only.At least size 1.
- Returns:
- by default,
this
- Since:
- 1.377
-
getDefaultAuthentication2
@NonNull default org.springframework.security.core.Authentication getDefaultAuthentication2()This method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticator
fails to authenticate the build.When the task execution touches other objects inside Jenkins, the access control is performed based on whether this
Authentication
is allowed to use them.- Returns:
- by default,
ACL.SYSTEM2
- Since:
- 2.266
- See Also:
-
getDefaultAuthentication
Deprecated.- Since:
- 1.520
-
getDefaultAuthentication2
@NonNull default org.springframework.security.core.Authentication getDefaultAuthentication2(Queue.Item item) This method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticator
fails to authenticate the build.When the task execution touches other objects inside Jenkins, the access control is performed based on whether this
Authentication
is allowed to use them.This method was added to an interface after it was created, so plugins built against older versions of Jenkins may not have this method implemented. Called private method _getDefaultAuthenticationOf(Task) on
Tasks
to avoidAbstractMethodError
.- Since:
- 2.266
- See Also:
-
getDefaultAuthentication
Deprecated.- Since:
- 1.592
-
getDefaultAuthentication2()