Package hudson.model

Class Node

    • Field Detail


        public static boolean SKIP_BUILD_CHECK_ON_FLYWEIGHTS
        See Also:
      • holdOffLaunchUntilSave

        protected transient volatile boolean holdOffLaunchUntilSave
        Newly copied agents get this flag set, so that Jenkins doesn't try to start/remove this node until its configuration is saved once.
    • Constructor Detail

      • Node

        public Node()
    • Method Detail

      • getSearchUrl

        public String getSearchUrl()
        Description copied from interface: SearchItem
        Returns the URL of this item relative to the parent SearchItem.
        Specified by:
        getSearchUrl in interface SearchItem
        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.)
      • isHoldOffLaunchUntilSave

        public boolean isHoldOffLaunchUntilSave()
      • getConfigFile

        protected XmlFile getConfigFile()
      • getNodeName

        public abstract String getNodeName()
        Name of this node.
        "" if this is master
      • setNodeName

        public abstract void setNodeName​(String name)
        to indicate that this method isn't really meant to be called by random code.
        When the user clones a Node, Hudson uses this method to change the node name right after the cloned Node object is instantiated.

        This method is never used for any other purpose, and as such for all practical intents and purposes, the node name should be treated like immutable.

      • getNodeDescription

        public abstract String getNodeDescription()
        Human-readable description of this node.
      • getNumExecutors

        public abstract int getNumExecutors()
        Returns the number of Executors. This may be different from getExecutors().size() because it takes time to adjust the number of executors.
      • getMode

        public abstract Node.Mode getMode()
        Returns Node.Mode.EXCLUSIVE if this node is only available for those jobs that exclusively specifies this node as the assigned node.
      • toComputer

        public final Computer toComputer()
        Gets the corresponding Computer object.
        this method can return null if there's no Computer object for this node, such as when this node has no executors at all.
      • getChannel

        public final hudson.remoting.VirtualChannel getChannel()
        Gets the current channel, if the node is connected and online, or null. This is just a convenience method for Computer.getChannel() with null check.
      • createComputer

        protected abstract Computer createComputer()
        Creates a new Computer object that acts as the UI peer of this Node. Nobody but Jenkins.updateComputerList() should call this method.
        Created instance of the computer. Can be null if the Node implementation does not support it (e.g. Cloud agent).
      • isAcceptingTasks

        public boolean isAcceptingTasks()
        Returns true if the node is accepting tasks. Needed to allow agents programmatic suspension of task scheduling that does not overlap with being offline. Called by Computer.isAcceptingTasks(). This method is distinct from Computer.isAcceptingTasks() as sometimes the Node concrete class may not have control over the Computer concrete class associated with it.
        true if the node is accepting tasks.
        See Also:
      • onLoad

        public void onLoad​(Nodes parent,
                           String name)
      • getTemporaryOfflineCause

        public OfflineCause getTemporaryOfflineCause()
        Get the cause if temporary offline.
        null if not temporary offline or there was no cause given.
      • getLabelCloud

        public TagCloud<LabelAtom> getLabelCloud()
        Return the possibly empty tag cloud for the labels of this node.
      • getLabelAtomSet

        protected Set<LabelAtom> getLabelAtomSet()
        An immutable set of LabelAtom associated with the current node label.
      • getAssignedLabels

        public Set<LabelAtom> getAssignedLabels()
        Returns the possibly empty set of labels that are assigned to this node, including the automatic self label, manually assigned labels and dynamically assigned labels via the LabelFinder extension point. This method has a side effect of updating the hudson-wide set of labels and should be called after events that will change that - e.g. an agent connecting.
      • getLabelString

        public abstract String getLabelString()
        Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available via getAssignedLabels() and includes all labels that have been manually configured. Mainly for form binding.
      • setLabelString

        public void setLabelString​(String labelString)
                            throws IOException
        Sets the label string for a node. This value will be returned by getLabelString().
        labelString - The new label string to use.
      • getSelfLabel

        public LabelAtom getSelfLabel()
        Gets the special label that represents this node itself.
      • canTake

        public CauseOfBlockage canTake​(Queue.BuildableItem item)
        Called by the Queue to determine whether or not this node can take the given task. The default checks include whether or not this node is part of the task's assigned label, whether this node is in Node.Mode.EXCLUSIVE mode if it is not in the task's assigned label, and whether or not any of this node's NodePropertys say that the task cannot be run.
      • getWorkspaceFor

        public abstract FilePath getWorkspaceFor​(TopLevelItem item)
        Returns a "workspace" directory for the given TopLevelItem.

        Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.

        null if this node is not connected hence the path is not available
      • getRootPath

        public abstract FilePath getRootPath()
        Gets the root directory of this node.

        Hudson always owns a directory on every node. This method returns that.

        null if the node is offline and hence the FilePath object is not available.
      • createPath

        public FilePath createPath​(String absolutePath)
        Gets the FilePath on this node.
      • getNodeProperty

        public <T extends NodeProperty> T getNodeProperty​(Class<T> clazz)
        Gets the specified property or null if the property is not configured for this Node.
        clazz - the type of the property
        null if the property is not configured
      • getNodeProperty

        public NodeProperty getNodeProperty​(String className)
        Gets the property from the given classname or null if the property is not configured for this Node.
        className - The classname of the property
        null if the property is not configured
      • getACL

        public ACL getACL()
        Description copied from interface: AccessControlled
        Obtains the ACL associated with this object.
        Specified by:
        getACL in interface AccessControlled
        never null.
      • reconfigure

        public Node reconfigure​(@NonNull
                                org.kohsuke.stapler.StaplerRequest req,
                                net.sf.json.JSONObject form)
                         throws Descriptor.FormException
        Description copied from interface: ReconfigurableDescribable
        When a parent/owner object of a Describable gets a config form submission and instances are recreated, this method is invoked on the existing instance (meaning the 'this' reference points to the existing instance) to create a new instance to be added to the parent/owner object.

        The default implementation of this should be the following:

         return form==null ? null : getDescriptor().newInstance(req, form);
        Specified by:
        reconfigure in interface ReconfigurableDescribable<Node>
        req - The current HTTP request being processed.
        form - JSON fragment that corresponds to this describable object. If the newly submitted form doesn't include a fragment for this describable (meaning the user has de-selected your descriptor), then this argument is null.
        The new instance. To not to create an instance of a describable, return null.
      • getDescriptor

        public abstract NodeDescriptor getDescriptor()
        Description copied from interface: Describable
        Gets the descriptor for this instance.

        Descriptor is a singleton for every concrete Describable implementation, so if a.getClass() == b.getClass() then by default a.getDescriptor() == b.getDescriptor() as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)

        Specified by:
        getDescriptor in interface Describable<Node>
      • getClockDifferenceCallable

        public abstract hudson.remoting.Callable<ClockDifference,​IOException> getClockDifferenceCallable()
        Returns a Callable that when run on the channel, estimates the clock difference.
        always non-null.
      • getRootDir

        public File getRootDir()
        Description copied from interface: PersistenceRoot
        Gets the root directory on the file system that this Item can use freely for storing the configuration data.

        This parameter is given by the ItemGroup when Item is loaded from memory.

        Specified by:
        getRootDir in interface PersistenceRoot