Interface Queue.Task
- All Superinterfaces:
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.Tasks is used
to collapse two tasks into one. This is used to avoid infinite
queue backlog.
Pending Queue.Tasks 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 voidChecks the permission to see if the current user can abort this executable.default StringReturns task-specific key which is used by theLoadBalancerto choose one particular executor amongst all the free executors on all possibly suitable nodes.default CauseOfBlockageIf the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.default AuthenticationDeprecated.default AuthenticationDeprecated.default org.springframework.security.core.AuthenticationThis method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticatorfails to authenticate the build.default org.springframework.security.core.AuthenticationThis method allows the task to provide the default fallback authentication object to be used whenQueueItemAuthenticatorfails to authenticate the build.getName()Unique name of this task.default Collection<? extends SubTask>Obtains theSubTasks that constitute this task.getUrl()Returns the URL of this task relative to the context root of the application.default StringDeprecated.as of 1.330 UseCauseOfBlockage.getShortDescription()instead.default booleanWorks just likecheckAbortPermission()except it indicates the status by a return value, instead of exception.default booleanDeprecated.UsegetCauseOfBlockage()!= nulldefault booleanTrue if the task allows concurrent builds, where the sameQueue.Taskis executed by multiple executors concurrently on the same or different nodes.Methods inherited from interface hudson.model.ModelObject
getDisplayNameMethods inherited from interface hudson.model.ResourceActivity
getDisplayName, getResourceListMethods 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()- See Also:
-
getAffinityKey
Returns task-specific key which is used by theLoadBalancerto 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
AccessControlledthis defaults tocheckPermission(hudson.model.Item.CANCEL);- Throws:
org.springframework.security.access.AccessDeniedException- if the permission is not granted.
-
hasAbortPermission
default boolean hasAbortPermission()Works just likecheckAbortPermission()except it indicates the status by a return value, instead of exception. Also used by default forQueueItem.hasCancelPermission().NOTE: If you have implemented
AccessControlledthis returns by defaultreturn hasPermission(hudson.model.Item.CANCEL);- Returns:
- false if the user doesn't have the permission.
-
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.
- Returns:
- URL that ends with '/'.
-
isConcurrentBuild
default boolean isConcurrentBuild()True if the task allows concurrent builds, where the sameQueue.Taskis executed by multiple executors concurrently on the same or different nodes.- Returns:
- by default, false
- Since:
- 1.338
-
getSubTasks
Obtains theSubTasks that constitute this task.The collection returned by this method must also contain the primary
SubTaskrepresented by thisQueue.Taskobject 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 whenQueueItemAuthenticatorfails to authenticate the build.When the task execution touches other objects inside Jenkins, the access control is performed based on whether this
Authenticationis 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 whenQueueItemAuthenticatorfails to authenticate the build.When the task execution touches other objects inside Jenkins, the access control is performed based on whether this
Authenticationis 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
Tasksto avoidAbstractMethodError.- Since:
- 2.266
- See Also:
-
getDefaultAuthentication
Deprecated.- Since:
- 1.592
-
getDefaultAuthentication2()