Package hudson.model

Class Queue.Item

    • Field Detail

      • task

        @Exported
        public final Queue.Task task
        Project to be built.
    • Method Detail

      • getId

        @Exported
        public long getId()
        Unique ID (per master) that tracks the Queue.Task as it moves through different stages in the queue (each represented by different subtypes of Queue.Item and into any subsequent Run instance (see Run.getQueueId()).
        Since:
        1.601
      • getIdLegacy

        @Deprecated
        public int getIdLegacy()
        Deprecated.
      • isBlocked

        @Exported
        public boolean isBlocked()
        Build is blocked because another build is in progress, required Resources are not available, or otherwise blocked by Queue.Task.isBuildBlocked().
      • isBuildable

        @Exported
        public boolean isBuildable()
        Build is waiting the executor to become available. This flag is only used in Queue.getItems() for 'pseudo' items that are actually not really in the queue.
      • isStuck

        @Exported
        public boolean isStuck()
        True if the item is starving for an executor for too long.
      • getInQueueSince

        @Exported
        public long getInQueueSince()
        Since when is this item in the queue.
        Returns:
        Unix timestamp
      • getInQueueForString

        public String getInQueueForString()
        Returns a human readable presentation of how long this item is already in the queue. E.g. something like '3 minutes 40 seconds'
      • getAssignedLabel

        @CheckForNull
        public Label getAssignedLabel()
        If this task needs to be run on a node with a particular label, return that Label. Otherwise null, indicating it can run on anywhere.

        This code takes LabelAssignmentAction into account, then fall back to SubTask.getAssignedLabel()

      • getAssignedLabelFor

        @CheckForNull
        public Label getAssignedLabelFor​(@NonNull
                                         SubTask st)
        Test if the specified SubTask needs to be run on a node with a particular label.

        This method takes LabelAssignmentAction into account, the first non-null assignment will be returned. Otherwise falls back to SubTask.getAssignedLabel()

        Parameters:
        st - SubTask to be checked.
        Returns:
        Required Label. Otherwise null, indicating it can run on anywhere.
      • getCauses

        public final List<Cause> getCauses()
        Convenience method that returns a read only view of the Causes associated with this item in the queue.
        Returns:
        can be empty but never null
        Since:
        1.343
      • getCausesDescription

        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        public String getCausesDescription()
      • getUrl

        @Exported
        public String getUrl()
        Returns the URL of this Queue.Item relative to the context path of Jenkins
        Returns:
        URL that ends with '/'.
        Since:
        1.519
      • getWhy

        @Exported
        public final String getWhy()
        Gets a human-readable status message describing why it's in the queue.
      • getCauseOfBlockage

        public abstract CauseOfBlockage getCauseOfBlockage()
        Gets an object that describes why this item is in the queue.
      • getParams

        @Exported
        public String getParams()
        Gets a human-readable message about the parameters of this item
        Returns:
        String
      • hasCancelPermission

        public boolean hasCancelPermission()
        Checks whether a scheduled item may be canceled.
        Returns:
        by default, the same as Queue.Task.hasAbortPermission()
      • getDisplayName

        public String getDisplayName()
      • getSearchUrl

        public String getSearchUrl()
        Description copied from interface: SearchItem
        Returns the URL of this item relative to the parent SearchItem.
        Returns:
        URL like "foo" or "foo/bar". The path can end with '/'. The path that starts with '/' will be interpreted as the absolute path (within the context path of Jenkins.)
      • authenticate2

        @NonNull
        public org.springframework.security.core.Authentication authenticate2()
        Returns the identity that this task carries when it runs, for the purpose of access control. When the task execution touches other objects inside Jenkins, the access control is performed based on whether this Authentication is allowed to use them. Implementers, if you are unsure, return the identity of the user who queued the task, or ACL.SYSTEM2 to bypass the access control and run as the super user.
        Since:
        2.266
      • getApi

        @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class)
        public Api getApi()
                   throws org.springframework.security.access.AccessDeniedException
        Throws:
        org.springframework.security.access.AccessDeniedException
      • readResolve

        protected Object readResolve()