Class Computer
- All Implemented Interfaces:
ExtensionPoint
,DescriptorByNameOwner
,ExecutorListener
,ModelObject
,SearchableModelObject
,SearchItem
,AccessControlled
,IComputer
,ModelObjectWithContextMenu
,HasWidgets
,org.kohsuke.stapler.StaplerProxy
- Direct Known Subclasses:
Jenkins.MasterComputer
,SlaveComputer
Executor
s.
Executor
s on one Computer
are transparently interchangeable
(that is the definition of Computer
).
This object is related to Node
but they have some significant differences.
Computer
primarily works as a holder of Executor
s, so
if a Node
is configured (probably temporarily) with 0 executors,
you won't have a Computer
object for it (except for the built-in node,
which always gets its Computer
in case we have no static executors and
we need to run a Queue.FlyweightTask
- see JENKINS-7291 for more discussion.)
Also, even if you remove a Node
, it takes time for the corresponding
Computer
to be removed, if some builds are already in progress on that
node. Or when the node configuration is changed, unaffected Computer
object
remains intact, while all the Node
objects will go away.
This object also serves UI (unlike Node
), and can be used along with
TransientComputerActionFactory
to add Action
s to Computer
s.
- Author:
- Kohsuke Kawaguchi
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
static class
Used to trace requests to terminate a computer.Nested classes/interfaces inherited from interface hudson.ExtensionPoint
ExtensionPoint.LegacyInstancesAreScopedToHudson
Nested classes/interfaces inherited from interface jenkins.model.ModelObjectWithContextMenu
ModelObjectWithContextMenu.ContextMenu, ModelObjectWithContextMenu.ContextMenuVisibility, ModelObjectWithContextMenu.MenuItem, ModelObjectWithContextMenu.MenuItemType
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Permission
static final Permission
static final Permission
static final Permission
static final Permission
static final Permission
static final Permission
static final Permission[]
protected String
Node
object may be created and deleted independently from this object.protected OfflineCause
Contains info about reason behind computer being offline.static final PermissionGroup
static boolean
Escape hatch for StaplerProxy-based access controlprotected final Object
static final ExecutorService
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract Future<?>
_connect
(boolean forceReconnect) Allows implementing-classes to provide an implementation for the connect method.protected void
_doScript
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String view) void
Adds a new action.buildEnvironment
(TaskListener listener) Creates an environment variable override to be used for launching processes on this node.void
cliConnect
(boolean force) Deprecated.void
cliDisconnect
(String cause) Deprecated.Implementation of CLI command "disconnect-node" moved toDisconnectNodeCommand
.void
cliOffline
(String cause) Deprecated.Implementation of CLI command "offline-node" moved toOfflineNodeCommand
.void
Deprecated.Implementation of CLI command "online-node" moved toOnlineNodeCommand
.final Future<?>
connect
(boolean forceReconnect) Do the same asdoLaunchSlaveAgent(StaplerRequest2, StaplerResponse2)
but outside the context of serving a request.final int
Returns the number ofIExecutor
s that are doing some work right now.final int
Returns the current size of the executor pool for this computer.int
Returns the number of idleExecutor
s that can start working immediately.static Computer
Gets the currentComputer
that the build is running.Future<?>
Deprecated.as of 1.320.Future<?>
disconnect
(OfflineCause cause) Disconnect this computer.org.kohsuke.stapler.HttpResponse
doChangeOfflineCause
(String offlineMessage) void
doConfigDotXml
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Acceptsconfig.xml
submission, as well as serve it.void
doConfigSubmit
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Accepts the update to the node configuration.org.kohsuke.stapler.HttpResponse
Really deletes the agent.void
doDumpExportTable
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Dumps the contents of the export table.abstract void
doLaunchSlaveAgent
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) IfgetChannel()
==null, attempts to relaunch the agent.void
doProgressiveLog
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Handles incremental log.void
doRssAll
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) void
doRssFailed
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) void
doRssLatest
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Retrieve the RSS feed for the last build for each project executed in this computer.void
doScript
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) For system diagnostics.void
doScriptText
(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) Run arbitrary Groovy script and return result as plain text.org.kohsuke.stapler.HttpResponse
doToggleOffline
(String offlineMessage) Returns the transientAction
s associated with the computer.Gets the read-only snapshot view of allExecutor
instances including OneOffExecutors.getApi()
abstract hudson.remoting.VirtualChannel
Gets the channel that can be used to run a program on this computer.Returns list of all boxesComputerPanelBox
s.final long
Gets the time (since epoch) when this computer connected.abstract Charset
Gets the default charset of this computer.final long
Returns the time when this computer first became in demand.Returns theNode
description for this computer.Used to render the list of executors.Returns cached environment variables (copy to prevent modification) for the JVM on this computer.Deprecated.as of 1.292 UsegetEnvironment()
instead.Gets the read-only snapshot view of allExecutor
s.Obtains the heap dump.This method tries to compute the name of the host that's reachable by all the other nodes.getIcon()
Returns the icon for this computer.Returns the class name that will be used to look up the icon.final long
Returns the time when this computer last became idle.getLog()
Gets the string representation of the agent log.protected File
Directory where rotated agent logs are stored.This is where the log from the remote agent goes.Gets the logs recorded by this agent.Used to URL-bindAnnotatedLargeText
.Expose monitoring data for the remote API.getName()
Returnsthe name of the node
.getNode()
Returns theNode
that this computer represents.int
Number ofExecutor
s that are configured for this computer.If the computer was offline (either temporarily or not), this method will return the cause.If the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).Gets the read-only snapshot view of allOneOffExecutor
s.abstract RetentionStrategy
RetentionStrategy
associated with this computer.Returns the URL of this item relative to the parentSearchItem
.Gets the system properties of the JVM on this computer.Returns the list of captured termination requests for this Computer.Gets the thread dump of the agent JVM.Returns projects that are tied on this node.Deprecated.getUrl()
Gets the object that coordinates the workspace allocation on this computer.boolean
void
Interrupt allExecutor
s.boolean
Returnstrue
if the computer is accepting tasks.protected boolean
isAlive()
Returns true if any of the executors are active.final boolean
isIdle()
Returns true if all the executors of this computer are idle.boolean
Deprecated.since 2008-05-18.boolean
boolean
This method is called to determine whether manual launching of the agent is allowed at this point in time.boolean
final boolean
isOnline()
final boolean
Returns true if this computer has some idle executors that can take more workload.boolean
Deprecated.You should almost always wantisOffline()
.abstract Boolean
isUnix()
True if this computer is a Unix machine (as opposed to Windows machine).protected void
kill()
Called byJenkins.updateComputerList()
to notifyComputer
that it will be discarded.final void
launch()
Deprecated.since 2009-01-06.protected void
Called byJenkins
when this computer is removed.void
This method captures the information of a request to terminate a computer instance.static void
Relocate log files in the old location to the new location.protected void
Called byExecutor
to kill excessive executors from this computer.static Computer
resolveForCLI
(String name) Used for CLI binding.protected void
void
setOfflineCause
(OfflineCause cause) Allows a caller to define anOfflineCause
for a computer that has never been online.void
setTemporarilyOffline
(boolean temporarilyOffline) Deprecated.as of 1.320.void
setTemporarilyOffline
(boolean temporarilyOffline, OfflineCause cause) Deprecated.UsesetTemporaryOfflineCause(OfflineCause)
instead.void
setTemporaryOfflineCause
(OfflineCause temporaryOfflineCause) Marks the computer as temporarily offline.void
updateByXml
(InputStream source) Updates Job by its XML definition.void
void
Blocks until the node becomes online/offline.Methods inherited from class hudson.model.Actionable
addOrReplaceAction, doContextMenu, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, getDynamic, removeAction, removeActions, replaceAction, replaceActions
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, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface hudson.security.AccessControlled
checkAnyPermission, checkPermission, hasAnyPermission, hasPermission, hasPermission, hasPermission2
Methods inherited from interface hudson.model.DescriptorByNameOwner
getDescriptorByName
Methods inherited from interface hudson.model.ExecutorListener
taskAccepted, taskCompleted, taskCompletedWithProblems, taskStarted
Methods inherited from interface jenkins.widgets.HasWidgets
getWidget, getWidgets
Methods inherited from interface jenkins.model.IComputer
getACL, getIconAltText, getTooltip, isConnecting
-
Field Details
-
offlineCause
Contains info about reason behind computer being offline. -
nodeName
Node
object may be created and deleted independently from this object. -
transientActions
-
statusChangeLock
-
threadPoolForRemoting
-
SKIP_PERMISSION_CHECK
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static boolean SKIP_PERMISSION_CHECKEscape hatch for StaplerProxy-based access control -
PERMISSIONS
-
CONFIGURE
-
EXTENDED_READ
- Since:
- 1.532
-
DELETE
-
CREATE
-
DISCONNECT
-
CONNECT
-
BUILD
-
EXTENDED_READ_AND_CONNECT
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public static final Permission[] EXTENDED_READ_AND_CONNECT
-
-
Constructor Details
-
Computer
-
-
Method Details
-
recordTermination
public void recordTermination()This method captures the information of a request to terminate a computer instance. Method is public as it needs to be called fromAbstractCloudSlave
andNodes
. In general you should not need to call this method directly, however if implementing a custom node type or a different path for removing nodes, it may make sense to call this method in order to capture the originating request.- Since:
- 1.607
-
getTerminatedBy
Returns the list of captured termination requests for this Computer. This method is used byExecutor
to provide details on why a Computer was removed in-between work being scheduled against theExecutor
and theExecutor
starting to execute the task.- Returns:
- the (possibly empty) list of termination requests.
- Since:
- 1.607
- See Also:
-
Executor.resetWorkUnit(String)
-
getComputerPanelBoxs
Returns list of all boxesComputerPanelBox
s. -
getActions
Returns the transientAction
s associated with the computer.- Overrides:
getActions
in classActionable
- Returns:
- a possibly empty list
-
addAction
Description copied from class:Actionable
Adds a new action. Note: calls toActionable.getAllActions()
that happen before calls to this method may not see the update. Note: this method will always modify the actions- Overrides:
addAction
in classActionable
-
getLogFile
This is where the log from the remote agent goes. The method also creates a log directory if required.- See Also:
-
getLogDir
Directory where rotated agent logs are stored. The method also creates a log directory if required.- Since:
- 1.613
-
getWorkspaceList
Gets the object that coordinates the workspace allocation on this computer. -
getLog
Gets the string representation of the agent log.- Throws:
IOException
-
getLogText
Used to URL-bindAnnotatedLargeText
. -
getOfflineCause
If the computer was offline (either temporarily or not), this method will return the cause.- Specified by:
getOfflineCause
in interfaceIComputer
- Returns:
- null if the system was put offline without given a cause.
-
hasOfflineCause
public boolean hasOfflineCause()- Specified by:
hasOfflineCause
in interfaceIComputer
- Returns:
true
if this computer has a defined offline cause, @{code false} otherwise.
-
getOfflineCauseReason
Description copied from interface:IComputer
If the computer was offline (either temporarily or not), this method will return the cause as a string (without user info).hasOfflineCause() == true
implies this must be nonempty.- Specified by:
getOfflineCauseReason
in interfaceIComputer
- Returns:
- empty string if the system was put offline without given a cause.
-
getChannel
@Nullable public abstract hudson.remoting.VirtualChannel getChannel()Gets the channel that can be used to run a program on this computer.- Returns:
- never null when
isOffline()
==false.
-
getDefaultCharset
Gets the default charset of this computer.- Returns:
- never null when
isOffline()
==false.
-
getLogRecords
Gets the logs recorded by this agent.- Throws:
IOException
InterruptedException
-
doLaunchSlaveAgent
public abstract void doLaunchSlaveAgent(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException IfgetChannel()
==null, attempts to relaunch the agent.- Throws:
IOException
jakarta.servlet.ServletException
-
launch
Deprecated.since 2009-01-06. Useconnect(boolean)
-
connect
Do the same asdoLaunchSlaveAgent(StaplerRequest2, StaplerResponse2)
but outside the context of serving a request.If already connected or if this computer doesn't support proactive launching, no-op. This method may return immediately while the launch operation happens asynchronously.
- Specified by:
connect
in interfaceIComputer
- Parameters:
forceReconnect
- 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.- Returns:
- A
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 asComputer
is connected it can be disconnected by some other threads.) - See Also:
-
_connect
Allows implementing-classes to provide an implementation for the connect method.If already connected or if this computer doesn't support proactive launching, no-op. This method may return immediately while the launch operation happens asynchronously.
- Parameters:
forceReconnect
- 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.- Returns:
- A
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 asComputer
is connected it can be disconnected by some other threads.) - See Also:
-
cliConnect
Deprecated.Implementation of CLI command "connect-node" moved toConnectNodeCommand
.- Parameters:
force
- If true cancel any currently pending connect operation and retry from scratch- Throws:
ExecutionException
InterruptedException
-
getConnectTime
public final long getConnectTime()Gets the time (since epoch) when this computer connected.- Returns:
- The time in ms since epoch when this computer last connected.
-
disconnect
Disconnect this computer. If this is the built-in node, no-op. This method may return immediately while the launch operation happens asynchronously.- Parameters:
cause
- Object that identifies the reason the node was disconnected.- Returns:
Future
to track the asynchronous disconnect operation.- Since:
- 1.320
- See Also:
-
disconnect
Deprecated.as of 1.320. Usedisconnect(OfflineCause)
and specify the cause.Equivalent todisconnect(null)
-
cliDisconnect
Deprecated.Implementation of CLI command "disconnect-node" moved toDisconnectNodeCommand
.- Parameters:
cause
- Record the note about why you are disconnecting this node- Throws:
ExecutionException
InterruptedException
-
cliOffline
Deprecated.Implementation of CLI command "offline-node" moved toOfflineNodeCommand
.- Parameters:
cause
- Record the note about why you are disconnecting this node- Throws:
ExecutionException
InterruptedException
-
cliOnline
Deprecated.Implementation of CLI command "online-node" moved toOnlineNodeCommand
. -
getNumExecutors
@Exported public int getNumExecutors()Number ofExecutor
s that are configured for this computer.When this value is decreased, it is temporarily possible for
executors
to have a larger number than this. -
getName
Description copied from interface:IComputer
Returnsthe name of the node
. -
isUnix
True if this computer is a Unix machine (as opposed to Windows machine).- Returns:
null
if the computer is disconnected and therefore we don't know whether it is Unix or not.- Since:
- 1.624
-
getNode
Returns theNode
that this computer represents.- Returns:
- null if the configuration has changed and the node is removed, yet the corresponding
Computer
is not yet gone.
-
getLoadStatistics
-
getTimeline
@Deprecated @Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public BuildTimelineWidget getTimeline()Deprecated. -
isOffline
@Exported public boolean isOffline() -
isOnline
public final boolean isOnline() -
isManualLaunchAllowed
@Exported public boolean isManualLaunchAllowed()This method is called to determine whether manual launching of the agent is allowed at this point in time.- Returns:
true
if manual launching of the agent is allowed at this point in time.
-
isJnlpAgent
Deprecated.since 2008-05-18. See isLaunchSupported() and ComputerLauncherReturns true if this computer is supposed to be launched via inbound protocol. -
isLaunchSupported
@Exported public boolean isLaunchSupported()- Specified by:
isLaunchSupported
in interfaceIComputer
- Returns:
- true if this computer can be launched by Jenkins proactively and automatically.
For example, inbound agents return
false
from this, because the launch process needs to be initiated from the agent side.
-
isTemporarilyOffline
Deprecated.You should almost always wantisOffline()
. This method is marked as deprecated to warn people when they accidentally call this method.Returns true if this node is marked temporarily offline by the user.In contrast,
isOffline()
represents the actual online/offline state. For example, this method may return false whileisOffline()
returns true if the agent failed to launch. -
setOfflineCause
Allows a caller to define anOfflineCause
for a computer that has never been online.- Since:
- TODO
-
setTemporarilyOffline
Deprecated.as of 1.320. UsesetTemporaryOfflineCause(OfflineCause)
-
setTemporarilyOffline
@Deprecated(since="2.482") public void setTemporarilyOffline(boolean temporarilyOffline, OfflineCause cause) Deprecated.UsesetTemporaryOfflineCause(OfflineCause)
instead. -
setTemporaryOfflineCause
Marks the computer as temporarily offline. This retains the underlyingChannel
connection, but prevent builds from executing.- Parameters:
temporaryOfflineCause
- The reason why the node is being put offline. If null, this cancels the status- Since:
- 2.482
-
getTemporaryOfflineCauseReason
- Returns:
- If the node is temporarily offline, the reason why.
- Since:
- 2.482
-
getIcon
Description copied from interface:IComputer
Returns the icon for this computer.It is both the recommended and default implementation to serve different icons based on
IComputer.isOffline()
-
getIconClassName
Returns the class name that will be used to look up the icon.This class name will be added as a class tag to the html img tags where the icon should show up followed by a size specifier given by
Icon.toNormalizedIconSizeClass(String)
The conversion of class tag to src tag is registered throughIconSet.addIcon(Icon)
- Specified by:
getIconClassName
in interfaceIComputer
- See Also:
-
getDisplayName
- Specified by:
getDisplayName
in interfaceIComputer
- Specified by:
getDisplayName
in interfaceModelObject
- Returns:
- the node name for UI purposes.
-
getCaption
-
getUrl
-
getAssignedLabels
-
getTiedJobs
Returns projects that are tied on this node. -
getBuilds
-
setNode
-
kill
protected void kill()Called byJenkins.updateComputerList()
to notifyComputer
that it will be discarded.Note that at this point
getNode()
returns null.- See Also:
-
onRemoved
protected void onRemoved()Called byJenkins
when this computer is removed.This happens when list of nodes are updated (for example by
Jenkins.setNodes(List)
and the computer becomes redundant. SuchComputer
s get killed, then after all its executors are finished, this method is called.Note that at this point
getNode()
returns null.- Since:
- 1.510
- See Also:
-
countIdle
public int countIdle()Returns the number of idleExecutor
s that can start working immediately. -
countBusy
public final int countBusy()Description copied from interface:IComputer
Returns the number ofIExecutor
s that are doing some work right now. -
countExecutors
public final int countExecutors()Returns the current size of the executor pool for this computer. This number may temporarily differ fromgetNumExecutors()
if there are busy tasks when the configured size is decreased. OneOffExecutors are not included in this count.- Specified by:
countExecutors
in interfaceIComputer
-
getExecutors
Gets the read-only snapshot view of allExecutor
s. -
getOneOffExecutors
Gets the read-only snapshot view of allOneOffExecutor
s. -
getAllExecutors
Gets the read-only snapshot view of allExecutor
instances including OneOffExecutors.- Returns:
- the read-only snapshot view of all
Executor
instances including OneOffExecutors. - Since:
- 2.55
-
getDisplayExecutors
Used to render the list of executors.- Specified by:
getDisplayExecutors
in interfaceIComputer
- Returns:
- a snapshot of the executor display information
- Since:
- 1.607
-
isIdle
@Exported public final boolean isIdle()Returns true if all the executors of this computer are idle. -
isPartiallyIdle
public final boolean isPartiallyIdle()Returns true if this computer has some idle executors that can take more workload. -
getIdleStartMilliseconds
public final long getIdleStartMilliseconds()Returns the time when this computer last became idle.If this computer is already idle, the return value will point to the time in the past since when this computer has been idle.
If this computer is busy, the return value will point to the time in the future where this computer will be expected to become free.
-
getDemandStartMilliseconds
public final long getDemandStartMilliseconds()Returns the time when this computer first became in demand. -
getDescription
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) @Exported @NonNull public String getDescription() -
removeExecutor
Called byExecutor
to kill excessive executors from this computer. -
isAlive
protected boolean isAlive()Returns true if any of the executors are active.- Since:
- 1.509
-
interrupt
public void interrupt()Interrupt allExecutor
s. Called fromJenkins.cleanUp()
. -
getSearchUrl
Description copied from interface:SearchItem
Returns the URL of this item relative to the parentSearchItem
.- Specified by:
getSearchUrl
in interfaceSearchItem
- 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.)
-
getRetentionStrategy
RetentionStrategy
associated with this computer.- Returns:
- never null. This method return
RetentionStrategy<? super T>
whereT=this.getClass()
.
-
getMonitorData
Expose monitoring data for the remote API. -
getMonitoringData
@Restricted(org.kohsuke.accmod.restrictions.NoExternalUse.class) public Map<NodeMonitor,Object> getMonitoringData() -
getSystemProperties
Gets the system properties of the JVM on this computer. If this is the master, it returns the system property of the master computer.- Throws:
IOException
InterruptedException
-
getEnvVars
Deprecated.as of 1.292 UsegetEnvironment()
instead.- Throws:
IOException
InterruptedException
-
getEnvironment
Returns cached environment variables (copy to prevent modification) for the JVM on this computer. If this is the master, it returns the system property of the master computer.- Throws:
IOException
InterruptedException
-
buildEnvironment
@NonNull public EnvVars buildEnvironment(@NonNull TaskListener listener) throws IOException, InterruptedException Creates an environment variable override to be used for launching processes on this node.- Throws:
IOException
InterruptedException
- Since:
- 1.489
- See Also:
-
getThreadDump
Gets the thread dump of the agent JVM.- Returns:
- key is the thread name, and the value is the pre-formatted dump.
- Throws:
IOException
InterruptedException
-
getHeapDump
Obtains the heap dump.- Throws:
IOException
-
getHostName
This method tries to compute the name of the host that's reachable by all the other nodes.Since it's possible that the agent is not reachable from the master (it may be behind a firewall, connecting to master via inbound protocol), this method may return null. It's surprisingly tricky for a machine to know a name that other systems can get to, especially between things like DNS search suffix, the hosts file, and YP.
So the technique here is to compute possible interfaces and names on the agent, then try to ping them from the master, and pick the one that worked.
The computation may take some time, so it employs caching to make the successive lookups faster.
- Returns:
- null if the host name cannot be computed (for example because this computer is offline, because the agent is behind the firewall, etc.)
- Throws:
IOException
InterruptedException
- Since:
- 1.300
-
doRssAll
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doRssAll(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
doRssFailed
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doRssFailed(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
doRssLatest
@Restricted(org.kohsuke.accmod.restrictions.DoNotUse.class) public void doRssLatest(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Retrieve the RSS feed for the last build for each project executed in this computer. Only the information fromAbstractProject
is displayed since there isn't a proper API to gather information about the node where the builds are executed for other sorts of projects such as Pipeline- Throws:
IOException
jakarta.servlet.ServletException
- Since:
- 2.215
-
doToggleOffline
public org.kohsuke.stapler.HttpResponse doToggleOffline(@QueryParameter String offlineMessage) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
doChangeOfflineCause
public org.kohsuke.stapler.HttpResponse doChangeOfflineCause(@QueryParameter String offlineMessage) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
getApi
-
doDumpExportTable
public void doDumpExportTable(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, InterruptedException Dumps the contents of the export table.- Throws:
IOException
jakarta.servlet.ServletException
InterruptedException
-
doScript
public void doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException For system diagnostics. Run arbitrary Groovy script.- Throws:
IOException
jakarta.servlet.ServletException
-
doScriptText
public void doScriptText(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Run arbitrary Groovy script and return result as plain text.- Throws:
IOException
jakarta.servlet.ServletException
-
_doScript
protected void _doScript(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp, String view) throws IOException, jakarta.servlet.ServletException - Throws:
IOException
jakarta.servlet.ServletException
-
doConfigSubmit
@POST public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException, Descriptor.FormException Accepts the update to the node configuration.- Throws:
IOException
jakarta.servlet.ServletException
Descriptor.FormException
-
doConfigDotXml
@WebMethod(name="config.xml") public void doConfigDotXml(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException, jakarta.servlet.ServletException Acceptsconfig.xml
submission, as well as serve it.- Throws:
IOException
jakarta.servlet.ServletException
-
updateByXml
Updates Job by its XML definition.- Throws:
IOException
jakarta.servlet.ServletException
- Since:
- 1.526
-
doDoDelete
Really deletes the agent.- Throws:
IOException
-
waitUntilOnline
Blocks until the node becomes online/offline.- Throws:
InterruptedException
-
waitUntilOffline
- Throws:
InterruptedException
-
doProgressiveLog
public void doProgressiveLog(org.kohsuke.stapler.StaplerRequest2 req, org.kohsuke.stapler.StaplerResponse2 rsp) throws IOException Handles incremental log.- Throws:
IOException
-
getTarget
- Specified by:
getTarget
in interfaceorg.kohsuke.stapler.StaplerProxy
-
currentComputer
Gets the currentComputer
that the build is running. This method only works when called during a build, such as byPublisher
,BuildWrapper
, etc.- Returns:
- the
Computer
associated withExecutor.currentExecutor()
, or (consistently as of 1.591) null if not on an executor thread
-
isAcceptingTasks
@OverrideMustInvoke public boolean isAcceptingTasks()Description copied from interface:IComputer
Returnstrue
if the computer is accepting tasks. Needed to allow agents programmatic suspension of task scheduling that does not overlap with being offline.- Specified by:
isAcceptingTasks
in interfaceIComputer
- Returns:
true
if the computer is accepting tasks- See Also:
-
resolveForCLI
@CLIResolver public static Computer resolveForCLI(String name) throws org.kohsuke.args4j.CmdLineException Used for CLI binding.- Throws:
org.kohsuke.args4j.CmdLineException
-
relocateOldLogs
Relocate log files in the old location to the new location. Files were used to be $JENKINS_ROOT/slave-NAME.log (and .1, .2, ...) but now they are at $JENKINS_ROOT/logs/slaves/NAME/slave.log (and .1, .2, ...)- See Also:
-
ConnectNodeCommand
.