public class SlaveComputer extends Computer
Computer.DisplayExecutor, Computer.TerminationRequestModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItemBUILD, CONFIGURE, CONNECT, CREATE, DELETE, DISCONNECT, EXTENDED_READ, nodeName, offlineCause, PERMISSIONS, statusChangeLock, threadPoolForRemoting, transientActions| Constructor and Description |
|---|
SlaveComputer(Slave slave) |
| Modifier and Type | Method and Description |
|---|---|
protected Future<?> |
_connect(boolean forceReconnect)
Allows implementing-classes to provide an implementation for the connect method.
|
Future<?> |
disconnect(OfflineCause cause)
Disconnect this computer.
|
org.kohsuke.stapler.HttpResponse |
doDoDisconnect(String offlineMessage) |
void |
doLaunchSlaveAgent(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
If
Computer.getChannel()==null, attempts to relaunch the slave agent. |
org.kohsuke.stapler.HttpResponse |
doSlaveAgentJnlp(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse res) |
String |
getAbsoluteRemoteFs()
Returns the remote FS root absolute path or
null if the slave is off-line. |
hudson.remoting.Channel |
getChannel()
Gets the channel that can be used to run a program on this computer.
|
static hudson.remoting.VirtualChannel |
getChannelToMaster()
Obtains a
VirtualChannel that allows some computation to be performed on the master. |
int |
getClassLoadingCount()
Shows
Channel.classLoadingCount. |
int |
getClassLoadingPrefetchCacheCount()
Shows
Channel.classLoadingPrefetchCacheCount. |
long |
getClassLoadingTime()
Shows
Channel.classLoadingTime. |
Charset |
getDefaultCharset()
Gets the default charset of this computer.
|
String |
getIcon() |
Slave.JnlpJar |
getJnlpJars(String fileName)
Deprecated.
since 2008-08-18.
This URL binding is no longer used and moved up directly under to
Jenkins,
but it's left here for now just in case some old JNLP slave agents request it. |
String |
getJnlpMac() |
ComputerLauncher |
getLauncher() |
List<LogRecord> |
getLogRecords()
Gets the logs recorded by this slave.
|
Slave |
getNode()
Returns the
Node that this computer represents. |
String |
getOSDescription()
Get the OS description.
|
int |
getResourceLoadingCount()
Shows
Channel.resourceLoadingCount. |
long |
getResourceLoadingTime()
Shows
Channel.resourceLoadingTime. |
RetentionStrategy |
getRetentionStrategy()
RetentionStrategy associated with this computer. |
String |
getSlaveVersion()
Get the slave version
|
static List<SlaveSystemInfo> |
getSystemInfoExtensions()
Helper method for Jelly.
|
protected ComputerLauncher |
grabLauncher(Node node)
|
boolean |
isAcceptingTasks()
Returns
true if the computer is accepting tasks. |
boolean |
isConnecting()
Is a
Computer.connect(boolean) operation in progress? |
boolean |
isJnlpAgent()
Deprecated.
since 2008-05-20.
|
boolean |
isLaunchSupported()
Returns true if this computer can be launched by Hudson proactively and automatically.
|
Boolean |
isUnix()
True if this computer is a Unix machine (as opposed to Windows machine).
|
protected void |
kill()
Called by
Jenkins.updateComputerList() to notify Computer that it will be discarded. |
OutputStream |
openLogFile() |
void |
setAcceptingTasks(boolean acceptingTasks)
Allows suspension of tasks being accepted by the slave computer.
|
void |
setChannel(hudson.remoting.Channel channel,
OutputStream launchLog,
hudson.remoting.Channel.Listener listener)
Sets up the connection through an existing channel.
|
void |
setChannel(InputStream in,
OutputStream out,
OutputStream launchLog,
hudson.remoting.Channel.Listener listener)
Creates a
Channel from the given stream and sets that to this slave. |
void |
setChannel(InputStream in,
OutputStream out,
TaskListener taskListener,
hudson.remoting.Channel.Listener listener) |
protected void |
setNode(Node node)
|
void |
taskAccepted(Executor executor,
Queue.Task task)
Called whenever a task is accepted by an executor.
|
void |
taskCompleted(Executor executor,
Queue.Task task,
long durationMS)
Called whenever a task is completed without any problems by an executor.
|
void |
taskCompletedWithProblems(Executor executor,
Queue.Task task,
long durationMS,
Throwable problems)
Called whenever a task is completed with some problems by an executor.
|
void |
tryReconnect() |
_doScript, addAction, buildEnvironment, checkPermission, cliConnect, cliDisconnect, cliOffline, cliOnline, connect, countBusy, countExecutors, countIdle, currentComputer, disconnect, doChangeOfflineCause, doConfigDotXml, doConfigSubmit, doDoDelete, doDumpExportTable, doProgressiveLog, doRssAll, doRssFailed, doScript, doScriptText, doToggleOffline, getACL, getActions, getApi, getBuilds, getCaption, getComputerPanelBoxs, getConnectTime, getDemandStartMilliseconds, getDisplayExecutors, getDisplayName, getEnvironment, getEnvVars, getExecutors, getHeapDump, getHostName, getIconAltText, getIconClassName, getIdleStartMilliseconds, getLoadStatistics, getLog, getLogDir, getLogFile, getLogText, getMonitorData, getName, getNumExecutors, getOfflineCause, getOfflineCauseReason, getOneOffExecutors, getSearchUrl, getSystemProperties, getTerminatedBy, getThreadDump, getTiedJobs, getTimeline, getUrl, getWorkspaceList, hasPermission, interrupt, isAlive, isIdle, isManualLaunchAllowed, isOffline, isOnline, isPartiallyIdle, isTemporarilyOffline, launch, onRemoved, recordTermination, relocateOldLogs, resolveForCLI, setTemporarilyOffline, setTemporarilyOffline, updateByXml, waitUntilOffline, waitUntilOnlinedoContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, replaceActiongetSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, sendError, sendError, sendError, sendError, sendErrorpublic SlaveComputer(Slave slave)
@OverrideMustInvoke(value=ANYTIME) public boolean isAcceptingTasks()
true if the computer is accepting tasks. Needed to allow slaves programmatic suspension of task
scheduling that does not overlap with being offline.isAcceptingTasks in class Computertrue if the computer is accepting tasksRetentionStrategy.isAcceptingTasks(Computer),
Node.isAcceptingTasks()public String getJnlpMac()
public void setAcceptingTasks(boolean acceptingTasks)
RetentionStrategy.isAcceptingTasks(hudson.model.Computer) if the
RetentionStrategy needs to control availability.acceptingTasks - true if the slave can accept tasks.public Boolean isUnix()
Computer@CheckForNull public Slave getNode()
ComputerNode that this computer represents.@Deprecated public boolean isJnlpAgent()
ComputerisJnlpAgent in class Computerpublic boolean isLaunchSupported()
Computer
For example, JNLP slaves return false from this, because the launch process
needs to be initiated from the slave side.
isLaunchSupported in class Computerpublic ComputerLauncher getLauncher()
protected Future<?> _connect(boolean forceReconnect)
ComputerIf already connected or if this computer doesn't support proactive launching, no-op. This method may return immediately while the launch operation happens asynchronously.
_connect in class ComputerforceReconnect - If true and a connect activity is already in progress, it will be cancelled and
the new one will be started. If false, and a connect activity is already in progress, this method
will do nothing and just return the pending connection operation.Future representing pending completion of the task. The 'completion' includes
both a successful completion and a non-successful completion (such distinction typically doesn't
make much sense because as soon as Computer is connected it can be disconnected by some other threads.)Computer.disconnect()public void taskAccepted(Executor executor, Queue.Task task)
taskAccepted in interface ExecutorListenertaskAccepted in class Computerexecutor - The executor.task - The task.public void taskCompleted(Executor executor, Queue.Task task, long durationMS)
taskCompleted in interface ExecutorListenertaskCompleted in class Computerexecutor - The executor.task - The task.durationMS - The number of milliseconds that the task took to complete.public void taskCompletedWithProblems(Executor executor, Queue.Task task, long durationMS, Throwable problems)
taskCompletedWithProblems in interface ExecutorListenertaskCompletedWithProblems in class Computerexecutor - The executor.task - The task.durationMS - The number of milliseconds that the task took to complete.problems - The exception that was thrown.public boolean isConnecting()
ComputerComputer.connect(boolean) operation in progress?isConnecting in class Computerpublic OutputStream openLogFile()
public void setChannel(InputStream in, OutputStream out, TaskListener taskListener, hudson.remoting.Channel.Listener listener) throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic void setChannel(InputStream in, OutputStream out, OutputStream launchLog, hudson.remoting.Channel.Listener listener) throws IOException, InterruptedException
Channel from the given stream and sets that to this slave.in - Stream connected to the remote "slave.jar". It's the caller's responsibility to do
buffering on this stream, if that's necessary.out - Stream connected to the remote peer. It's the caller's responsibility to do
buffering on this stream, if that's necessary.launchLog - If non-null, receive the portion of data in is before
the data goes into the "binary mode". This is useful
when the established communication channel might include some data that might
be useful for debugging/trouble-shooting.listener - Gets a notification when the channel closes, to perform clean up. Can be null.
By the time this method is called, the cause of the termination is reported to the user,
so the implementation of the listener doesn't need to do that again.IOExceptionInterruptedExceptionpublic int getClassLoadingCount()
throws IOException,
InterruptedException
Channel.classLoadingCount.IOExceptionInterruptedExceptionpublic int getClassLoadingPrefetchCacheCount()
throws IOException,
InterruptedException
Channel.classLoadingPrefetchCacheCount.IOExceptionInterruptedExceptionpublic int getResourceLoadingCount()
throws IOException,
InterruptedException
Channel.resourceLoadingCount.IOExceptionInterruptedExceptionpublic long getClassLoadingTime()
throws IOException,
InterruptedException
Channel.classLoadingTime.IOExceptionInterruptedExceptionpublic long getResourceLoadingTime()
throws IOException,
InterruptedException
Channel.resourceLoadingTime.IOExceptionInterruptedException@CheckForNull public String getAbsoluteRemoteFs()
null if the slave is off-line. The absolute path may change
between connections if the connection method does not provide a consistent working directory and the node's
remote FS is specified as a relative path.null if the slave is off-line.public void setChannel(hudson.remoting.Channel channel,
OutputStream launchLog,
hudson.remoting.Channel.Listener listener)
throws IOException,
InterruptedException
channel - the channel to use; warning: callers are expected to have called ChannelConfigurator alreadyIOExceptionInterruptedExceptionpublic hudson.remoting.Channel getChannel()
ComputergetChannel in class ComputerComputer.isOffline()==false.public Charset getDefaultCharset()
ComputergetDefaultCharset in class ComputerComputer.isOffline()==false.public List<LogRecord> getLogRecords() throws IOException, InterruptedException
ComputergetLogRecords in class ComputerIOExceptionInterruptedExceptionpublic org.kohsuke.stapler.HttpResponse doDoDisconnect(@QueryParameter
String offlineMessage)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionpublic Future<?> disconnect(OfflineCause cause)
Computerdisconnect in class Computercause - Object that identifies the reason the node was disconnected.Future to track the asynchronous disconnect operation.Computer.connect(boolean)public void doLaunchSlaveAgent(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
ComputerComputer.getChannel()==null, attempts to relaunch the slave agent.doLaunchSlaveAgent in class ComputerIOExceptionjavax.servlet.ServletExceptionpublic void tryReconnect()
@Deprecated public Slave.JnlpJar getJnlpJars(String fileName)
Jenkins,
but it's left here for now just in case some old JNLP slave agents request it.@WebMethod(name="slave-agent.jnlp")
public org.kohsuke.stapler.HttpResponse doSlaveAgentJnlp(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse res)
throws IOException,
javax.servlet.ServletException
IOExceptionjavax.servlet.ServletExceptionprotected void kill()
ComputerJenkins.updateComputerList() to notify Computer that it will be discarded.
Note that at this point Computer.getNode() returns null.
kill in class ComputerComputer.onRemoved()public RetentionStrategy getRetentionStrategy()
ComputerRetentionStrategy associated with this computer.getRetentionStrategy in class ComputerRetentionStrategy<? super T> where
T=this.getClass().protected ComputerLauncher grabLauncher(Node node)
ComputerLauncher out of Node to keep it in this Computer.
The returned launcher will be set to launcher and used to carry out the actual launch operation.
Subtypes that needs to decorate ComputerLauncher can do so by overriding this method.
This is useful for SlaveComputers for clouds for example, where one normally needs
additional pre-launch step (such as waiting for the provisioned node to become available)
before the user specified launch step (like SSH connection) kicks in.
ComputerLauncherFilterpublic String getSlaveVersion() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic String getOSDescription() throws IOException, InterruptedException
IOExceptionInterruptedExceptionpublic static hudson.remoting.VirtualChannel getChannelToMaster()
VirtualChannel that allows some computation to be performed on the master.
This method can be called from any thread on the master, or from slave (more precisely,
it only works from the remoting request-handling thread in slaves, which means if you've started
separate thread on slaves, that'll fail.)public static List<SlaveSystemInfo> getSystemInfoExtensions()
Copyright © 2019. All rights reserved.