Class QueueTaskFilter
- java.lang.Object
-
- hudson.model.queue.QueueTaskFilter
-
- All Implemented Interfaces:
ModelObject,SubTask,Queue.Task,ResourceActivity
public abstract class QueueTaskFilter extends Object implements Queue.Task
Base class for defining filterQueue.Task.- Since:
- 1.360
- Author:
- Kohsuke Kawaguchi
-
-
Constructor Summary
Constructors Modifier Constructor Description protectedQueueTaskFilter(Queue.Task base)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidcheckAbortPermission()Checks the permission to see if the current user can abort this executable.Queue.ExecutablecreateExecutable()Creates an object which performs the actual execution of the task.LabelgetAssignedLabel()If this task needs to be run on a node with a particular label, return thatLabel.CauseOfBlockagegetCauseOfBlockage()If the execution of this task should be blocked for temporary reasons, this method returns a non-null object explaining why.StringgetDisplayName()Used for rendering HTML.longgetEstimatedDuration()Estimate of how long will it take to execute this task.StringgetFullDisplayName()NodegetLastBuiltOn()If the previous execution of this task run on a certain node and this task prefers to run on the same node, return that.StringgetName()Unique name of this task.ResourceListgetResourceList()Gets the list ofResources that this task requires.ObjectgetSameNodeConstraint()If a subset ofSubTasks of aQueue.Taskneeds to be collocated with otherSubTasks, thoseSubTasks should return the equal object here.Collection<? extends SubTask>getSubTasks()Obtains theSubTasks that constitute this task.StringgetUrl()Returns the URL of this task relative to the context root of the application.StringgetWhyBlocked()Deprecated.booleanhasAbortPermission()Works just likeQueue.Task.checkAbortPermission()except it indicates the status by a return value, instead of exception.booleanisBuildBlocked()Deprecated.booleanisConcurrentBuild()True if the task allows concurrent builds, where the sameQueue.Taskis executed by multiple executors concurrently on the same or different nodes.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface hudson.model.Queue.Task
getAffinityKey, getDefaultAuthentication, getDefaultAuthentication, getDefaultAuthentication2, getDefaultAuthentication2
-
Methods inherited from interface hudson.model.queue.SubTask
getOwnerExecutable, getOwnerTask
-
-
-
-
Constructor Detail
-
QueueTaskFilter
protected QueueTaskFilter(Queue.Task base)
-
-
Method Detail
-
getAssignedLabel
public Label getAssignedLabel()
Description copied from interface:SubTaskIf this task needs to be run on a node with a particular label, return thatLabel. Otherwise null, indicating it can run on anywhere.- Specified by:
getAssignedLabelin interfaceSubTask- Returns:
- by default, null
-
getLastBuiltOn
public Node getLastBuiltOn()
Description copied from interface:SubTaskIf the previous execution of this task run on a certain node and this task prefers to run on the same node, return that. Otherwise null.- Specified by:
getLastBuiltOnin interfaceSubTask- Returns:
- by default, null
-
isBuildBlocked
@Deprecated public boolean isBuildBlocked()
Deprecated.Description copied from interface:Queue.TaskReturns true if the execution should be blocked for temporary reasons.- Specified by:
isBuildBlockedin interfaceQueue.Task
-
getWhyBlocked
@Deprecated public String getWhyBlocked()
Deprecated.- Specified by:
getWhyBlockedin interfaceQueue.Task
-
getCauseOfBlockage
public CauseOfBlockage getCauseOfBlockage()
Description copied from interface:Queue.TaskIf 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().- Specified by:
getCauseOfBlockagein interfaceQueue.Task- Returns:
- by default, null
-
getName
public String getName()
Description copied from interface:Queue.TaskUnique name of this task.This method is no longer used, left here for compatibility. Just return
ModelObject.getDisplayName().- Specified by:
getNamein interfaceQueue.Task
-
getFullDisplayName
public String getFullDisplayName()
- Specified by:
getFullDisplayNamein interfaceQueue.Task- See Also:
Item.getFullDisplayName()
-
getEstimatedDuration
public long getEstimatedDuration()
Description copied from interface:SubTaskEstimate of how long will it take to execute this task. Measured in milliseconds.- Specified by:
getEstimatedDurationin interfaceSubTask- Returns:
- -1 if it's impossible to estimate (the default)
-
createExecutable
@CheckForNull public Queue.Executable createExecutable() throws IOException
Description copied from interface:SubTaskCreates an object which performs the actual execution of the task.- Specified by:
createExecutablein interfaceSubTask- Returns:
- executable to be launched or null if the executable cannot be
created (e.g.
AbstractProjectis disabled) - Throws:
IOException- executable cannot be created
-
checkAbortPermission
public void checkAbortPermission()
Description copied from interface:Queue.TaskChecks 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);- Specified by:
checkAbortPermissionin interfaceQueue.Task
-
hasAbortPermission
public boolean hasAbortPermission()
Description copied from interface:Queue.TaskWorks just likeQueue.Task.checkAbortPermission()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);- Specified by:
hasAbortPermissionin interfaceQueue.Task- Returns:
- false if the user doesn't have the permission.
-
getUrl
public String getUrl()
Description copied from interface:Queue.TaskReturns 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.
- Specified by:
getUrlin interfaceQueue.Task- Returns:
- URL that ends with '/'.
-
isConcurrentBuild
public boolean isConcurrentBuild()
Description copied from interface:Queue.TaskTrue if the task allows concurrent builds, where the sameQueue.Taskis executed by multiple executors concurrently on the same or different nodes.- Specified by:
isConcurrentBuildin interfaceQueue.Task- Returns:
- by default, false
-
getDisplayName
public String getDisplayName()
Description copied from interface:ResourceActivityUsed for rendering HTML.- Specified by:
getDisplayNamein interfaceModelObject- Specified by:
getDisplayNamein interfaceResourceActivity
-
getResourceList
public ResourceList getResourceList()
Description copied from interface:ResourceActivityGets the list ofResources that this task requires. Used to make sure no two conflicting tasks run concurrently.This method must always return the
ResourceListthat contains the exact same set ofResources.If the activity doesn't lock any resources, just return
ResourceList.EMPTY(or decline to override).- Specified by:
getResourceListin interfaceResourceActivity- Returns:
- never null
-
getSubTasks
public Collection<? extends SubTask> getSubTasks()
Description copied from interface:Queue.TaskObtains 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.
- Specified by:
getSubTasksin interfaceQueue.Task- Returns:
- by default,
this
-
getSameNodeConstraint
public Object getSameNodeConstraint()
Description copied from interface:SubTaskIf a subset ofSubTasks of aQueue.Taskneeds to be collocated with otherSubTasks, thoseSubTasks should return the equal object here. If null, the execution unit isn't under a colocation constraint.- Specified by:
getSameNodeConstraintin interfaceSubTask- Returns:
- by default, null
-
-