Class Slave
- All Implemented Interfaces:
ExtensionPoint
,Describable<Node>
,ModelObject
,PersistenceRoot
,ReconfigurableDescribable<Node>
,Saveable
,SearchableModelObject
,SearchItem
,AccessControlled
,Serializable
,OnMaster
- Direct Known Subclasses:
AbstractCloudSlave
,DumbSlave
Ideally this would have been in the hudson.slaves
package,
but for compatibility reasons, it can't.
TODO: move out more stuff to DumbSlave
.
On February, 2016 a general renaming was done internally: the "slave" term was replaced by
"Agent". This change was applied in: UI labels/HTML pages, javadocs and log messages.
Java classes, fields, methods, etc were not renamed to avoid compatibility issues.
See JENKINS-27268.
- Author:
- Kohsuke Kawaguchi
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final class
Web-bound object used to serve jar files for inbound connections.static class
Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
Name of this agent node.protected final String
Path to the root of the workspace from the view point of this node, such as "/hudson", this need not be absolute provided that the launcher establishes a consistent working directory, such as "./.jenkins-agent" when used with an SSH launcher.Fields inherited from class hudson.model.Node
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS
-
Constructor Summary
ModifierConstructorDescriptionprotected
Slave
(String name, String remoteFS, ComputerLauncher launcher) protected
Slave
(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy) Deprecated.since 2009-02-20.protected
Slave
(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties) Deprecated.as of 2.2 UseSlave(String, String, ComputerLauncher)
and set the rest through setters.protected
Slave
(String name, String nodeDescription, String remoteFS, String numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties) Deprecated.since 2.184 -
Method Summary
Modifier and TypeMethodDescriptioncreateLauncher
(TaskListener listener) Creates a launcher for the agent.boolean
hudson.remoting.Callable<ClockDifference,
IOException> Returns aCallable
that when run on the channel, estimates the clock difference.Gets the corresponding computer object.Gets the descriptor for this instance.Returns the manually configured label for a node.getMode()
ReturnsNode.Mode.EXCLUSIVE
if this node is only available for those jobs that exclusively specifies this node as the assigned node.Human-readable description of this node.Name of this node.Gets theNodeProperty
instances configured for thisNode
.int
Returns the number ofExecutor
s.Gets the root directory of this node.Deprecated.Removed with no replacementgetWorkspaceFor
(TopLevelItem item) Returns a "workspace" directory for the givenTopLevelItem
.Root directory on this agent where all the job workspaces are laid out.int
hashCode()
protected Object
Invoked by XStream when this object is read into memory.void
setLabelString
(String labelString) Sets the label string for a node.void
setLauncher
(ComputerLauncher launcher) void
void
setNodeDescription
(String value) void
setNodeName
(String name) void
setNodeProperties
(List<? extends NodeProperty<?>> properties) void
setNumExecutors
(int n) void
setRetentionStrategy
(RetentionStrategy availabilityStrategy) void
Deprecated.Removed with no replacementtoString()
Methods inherited from class hudson.model.Node
canTake, canTake, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getConfigFile, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getRootDir, getSearchUrl, getSelfLabel, getTemporaryOfflineCause, isAcceptingTasks, isHoldOffLaunchUntilSave, onLoad, reconfigure, reconfigure, save, toComputer
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError, sendError, sendError, sendError
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
Methods inherited from interface hudson.search.SearchItem
getSearchIcon
-
Field Details
-
name
Name of this agent node. -
remoteFS
Path to the root of the workspace from the view point of this node, such as "/hudson", this need not be absolute provided that the launcher establishes a consistent working directory, such as "./.jenkins-agent" when used with an SSH launcher. NOTE: if the administrator is using a relative path they are responsible for ensuring that the launcher used provides a consistent working directory
-
-
Constructor Details
-
Slave
@Deprecated protected Slave(String name, String nodeDescription, String remoteFS, String numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties) throws Descriptor.FormException, IOException Deprecated.since 2.184UseSlave(String, String, ComputerLauncher)
and set the rest through setters.- Throws:
Descriptor.FormException
IOException
-
Slave
@Deprecated protected Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy) throws Descriptor.FormException, IOException Deprecated.since 2009-02-20.- Throws:
Descriptor.FormException
IOException
-
Slave
protected Slave(@NonNull String name, String remoteFS, ComputerLauncher launcher) throws Descriptor.FormException, IOException - Throws:
Descriptor.FormException
IOException
-
Slave
@Deprecated protected Slave(@NonNull String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy, List<? extends NodeProperty<?>> nodeProperties) throws Descriptor.FormException, IOException Deprecated.as of 2.2 UseSlave(String, String, ComputerLauncher)
and set the rest through setters.- Throws:
Descriptor.FormException
IOException
-
-
Method Details
-
getUserId
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.220") public String getUserId()Deprecated.Removed with no replacementReturn id of user which created this agent- Returns:
- id of user
-
setUserId
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @RestrictedSince("2.220") public void setUserId(String userId) Deprecated.Removed with no replacementThis method no longer does anything. -
getLauncher
-
setLauncher
-
getRemoteFS
-
getNodeName
Description copied from class:Node
Name of this node.- Specified by:
getNodeName
in classNode
- Returns:
- "" if this is master
-
toString
-
setNodeName
Description copied from class:Node
When the user clones aNode
, Hudson uses this method to change the node name right after the clonedNode
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.
- Specified by:
setNodeName
in classNode
-
setNodeDescription
-
getNodeDescription
Description copied from class:Node
Human-readable description of this node.- Specified by:
getNodeDescription
in classNode
-
getNumExecutors
public int getNumExecutors()Description copied from class:Node
Returns the number ofExecutor
s. This may be different fromgetExecutors().size()
because it takes time to adjust the number of executors.- Specified by:
getNumExecutors
in classNode
-
setNumExecutors
@DataBoundSetter public void setNumExecutors(int n) -
getMode
Description copied from class:Node
ReturnsNode.Mode.EXCLUSIVE
if this node is only available for those jobs that exclusively specifies this node as the assigned node. -
setMode
-
getNodeProperties
Description copied from class:Node
Gets theNodeProperty
instances configured for thisNode
.- Specified by:
getNodeProperties
in classNode
-
setNodeProperties
@DataBoundSetter public void setNodeProperties(List<? extends NodeProperty<?>> properties) throws IOException - Throws:
IOException
-
getRetentionStrategy
-
setRetentionStrategy
-
getLabelString
Description copied from class:Node
Returns the manually configured label for a node. The list of assigned and dynamically determined labels is available viaNode.getAssignedLabels()
and includes all labels that have been manually configured. Mainly for form binding.- Specified by:
getLabelString
in classNode
-
setLabelString
Description copied from class:Node
Sets the label string for a node. This value will be returned byNode.getLabelString()
.- Overrides:
setLabelString
in classNode
- Parameters:
labelString
- The new label string to use.- Throws:
IOException
-
getLabelAtomSet
- Overrides:
getLabelAtomSet
in classNode
- Returns:
- An immutable set of LabelAtom associated with the current node label.
-
getClockDifferenceCallable
Description copied from class:Node
Returns aCallable
that when run on the channel, estimates the clock difference.- Specified by:
getClockDifferenceCallable
in classNode
- Returns:
- always non-null.
-
createComputer
Description copied from class:Node
Creates a newComputer
object that acts as the UI peer of thisNode
. Nobody butJenkins.updateComputerList()
should call this method.- Specified by:
createComputer
in classNode
- Returns:
- Created instance of the computer.
Can be
null
if theNode
implementation does not support it (e.g.Cloud
agent).
-
getWorkspaceFor
Description copied from class:Node
Returns a "workspace" directory for the givenTopLevelItem
.Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.
- Specified by:
getWorkspaceFor
in classNode
- Returns:
- null if this node is not connected hence the path is not available
-
getRootPath
Description copied from class:Node
Gets the root directory of this node.Hudson always owns a directory on every node. This method returns that.
- Specified by:
getRootPath
in classNode
- Returns:
- null if the node is offline and hence the
FilePath
object is not available.
-
getWorkspaceRoot
Root directory on this agent where all the job workspaces are laid out.- Returns:
- null if not connected.
-
createLauncher
Creates a launcher for the agent.- Specified by:
createLauncher
in classNode
- Returns:
- If there is no computer it will return a
Launcher.DummyLauncher
, otherwise it will return aLauncher.RemoteLauncher
instead.
-
getComputer
Gets the corresponding computer object.- Returns:
- this method can return null if there's no
Computer
object for this node, such as when this node has no executors at all.
-
equals
-
hashCode
public int hashCode() -
readResolve
Invoked by XStream when this object is read into memory. -
getDescriptor
Description copied from interface:Describable
Gets the descriptor for this instance.Descriptor
is a singleton for every concreteDescribable
implementation, so ifa.getClass() == b.getClass()
then by defaulta.getDescriptor() == b.getDescriptor()
as well. (In rare cases a single implementation class may be used for instances with distinct descriptors.)- Specified by:
getDescriptor
in interfaceDescribable<Node>
- Specified by:
getDescriptor
in classNode
-