public abstract class Slave extends Node implements Serializable
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.
Modifier and Type | Class and Description |
---|---|
static class |
Slave.JnlpJar
Web-bound object used to serve jar files for JNLP.
|
static class |
Slave.SlaveDescriptor |
Node.InternalComputerListener, Node.Mode
ExtensionPoint.LegacyInstancesAreScopedToHudson
Modifier and Type | Field and Description |
---|---|
protected String |
name
Name of this agent node.
|
protected String |
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-slave"
when used with an SSH launcher.
|
holdOffLaunchUntilSave, SKIP_BUILD_CHECK_ON_FLYWEIGHTS
Constructor and Description |
---|
Slave(String name,
String remoteFS,
ComputerLauncher launcher) |
Slave(String name,
String nodeDescription,
String remoteFS,
int numExecutors,
Node.Mode mode,
String labelString,
ComputerLauncher launcher,
RetentionStrategy retentionStrategy)
Deprecated.
since 2009-02-20.
|
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
Use
Slave(String, String, ComputerLauncher) and set the rest through setters. |
Slave(String name,
String nodeDescription,
String remoteFS,
String numExecutors,
Node.Mode mode,
String labelString,
ComputerLauncher launcher,
RetentionStrategy retentionStrategy,
List<? extends NodeProperty<?>> nodeProperties) |
Modifier and Type | Method and Description |
---|---|
Computer |
createComputer()
|
Launcher |
createLauncher(TaskListener listener)
Creates a launcher for the agent.
|
boolean |
equals(Object o) |
hudson.remoting.Callable<ClockDifference,IOException> |
getClockDifferenceCallable()
Returns a
Callable that when run on the channel, estimates the clock difference. |
SlaveComputer |
getComputer()
Gets the corresponding computer object.
|
Slave.SlaveDescriptor |
getDescriptor()
Gets the descriptor for this instance.
|
String |
getLabelString()
Returns the manually configured label for a node.
|
ComputerLauncher |
getLauncher() |
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. |
String |
getNodeDescription()
Human-readable description of this node.
|
String |
getNodeName()
Name of this node.
|
DescribableList<NodeProperty<?>,NodePropertyDescriptor> |
getNodeProperties()
Gets the
NodeProperty instances configured for this Node . |
int |
getNumExecutors()
Returns the number of
Executor s. |
String |
getRemoteFS() |
RetentionStrategy |
getRetentionStrategy() |
FilePath |
getRootPath()
Gets the root directory of this node.
|
String |
getUserId()
Return id of user which created this agent
|
FilePath |
getWorkspaceFor(TopLevelItem item)
Returns a "workspace" directory for the given
TopLevelItem . |
FilePath |
getWorkspaceRoot()
Root directory on this agent where all the job workspaces are laid out.
|
int |
hashCode() |
protected Object |
readResolve()
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 |
setMode(Node.Mode mode) |
void |
setNodeDescription(String value) |
void |
setNodeName(String name)
|
void |
setNodeProperties(List<? extends NodeProperty<?>> properties) |
void |
setNumExecutors(int n) |
void |
setRetentionStrategy(RetentionStrategy availabilityStrategy) |
void |
setUserId(String userId) |
String |
toString() |
canTake, canTake, createPath, getACL, getAssignedLabels, getChannel, getClockDifference, getDisplayName, getFileSystemProvisioner, getLabelCloud, getNodeProperty, getNodeProperty, getNodePropertyDescriptors, getSearchUrl, getSelfLabel, isAcceptingTasks, isHoldOffLaunchUntilSave, reconfigure, save, toComputer
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendError
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
checkPermission, hasPermission, hasPermission
protected String name
protected final String remoteFS
public 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
Descriptor.FormException
IOException
@Deprecated public Slave(String name, String nodeDescription, String remoteFS, int numExecutors, Node.Mode mode, String labelString, ComputerLauncher launcher, RetentionStrategy retentionStrategy) throws Descriptor.FormException, IOException
Descriptor.FormException
IOException
public Slave(@Nonnull String name, String remoteFS, ComputerLauncher launcher) throws Descriptor.FormException, IOException
Descriptor.FormException
IOException
@Deprecated public 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
Slave(String, String, ComputerLauncher)
and set the rest through setters.Descriptor.FormException
IOException
public String getUserId()
public void setUserId(String userId)
public ComputerLauncher getLauncher()
public void setLauncher(ComputerLauncher launcher)
public String getRemoteFS()
public String getNodeName()
Node
getNodeName
in class Node
public void setNodeName(String name)
Node
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.
setNodeName
in class Node
@DataBoundSetter public void setNodeDescription(String value)
public String getNodeDescription()
Node
getNodeDescription
in class Node
public int getNumExecutors()
Node
Executor
s.
This may be different from getExecutors().size()
because it takes time to adjust the number of executors.getNumExecutors
in class Node
@DataBoundSetter public void setNumExecutors(int n)
public Node.Mode getMode()
Node
Node.Mode.EXCLUSIVE
if this node is only available
for those jobs that exclusively specifies this node
as the assigned node.@DataBoundSetter public void setMode(Node.Mode mode)
public DescribableList<NodeProperty<?>,NodePropertyDescriptor> getNodeProperties()
Node
NodeProperty
instances configured for this Node
.getNodeProperties
in class Node
@DataBoundSetter public void setNodeProperties(List<? extends NodeProperty<?>> properties) throws IOException
IOException
public RetentionStrategy getRetentionStrategy()
@DataBoundSetter public void setRetentionStrategy(RetentionStrategy availabilityStrategy)
public String getLabelString()
Node
Node.getAssignedLabels()
and includes all labels that have been
manually configured.
Mainly for form binding.getLabelString
in class Node
@DataBoundSetter public void setLabelString(String labelString) throws IOException
Node
Node.getLabelString()
.setLabelString
in class Node
labelString
- The new label string to use.IOException
public hudson.remoting.Callable<ClockDifference,IOException> getClockDifferenceCallable()
Node
Callable
that when run on the channel, estimates the clock difference.getClockDifferenceCallable
in class Node
public Computer createComputer()
Node
Computer
object that acts as the UI peer of this Node
.
Nobody but Jenkins.updateComputerList()
should call this method.createComputer
in class Node
null
if the Node
implementation does not support it (e.g. Cloud
agent).public FilePath getWorkspaceFor(TopLevelItem item)
Node
TopLevelItem
.
Workspace directory is usually used for keeping out the checked out source code, but it can be used for anything.
getWorkspaceFor
in class Node
@CheckForNull public FilePath getRootPath()
Node
Hudson always owns a directory on every node. This method returns that.
getRootPath
in class Node
FilePath
object is not available.@CheckForNull public FilePath getWorkspaceRoot()
@Nonnull public Launcher createLauncher(TaskListener listener)
createLauncher
in class Node
Launcher.DummyLauncher
, otherwise it
will return a Launcher.RemoteLauncher
instead.@CheckForNull public SlaveComputer getComputer()
Computer
object for this node,
such as when this node has no executors at all.protected Object readResolve()
public Slave.SlaveDescriptor getDescriptor()
Describable
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.)
getDescriptor
in interface Describable<Node>
getDescriptor
in class Node
Copyright © 2004–2019. All rights reserved.