|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecthudson.model.AbstractModelObject
hudson.model.Actionable
hudson.model.Computer
@ExportedBean public abstract class Computer
Represents the running state of a remote computer that holds
Executors.
Executors on one Computer are transparently
interchangeable (that is the definition of Computer.)
This object is related to Node but they have some significant
difference. Computer primarily works as a holder of
Executors, so if a Node is configured (probably temporarily)
with 0 executors, you won't have a Computer object for it.
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 (since Node is an interface and can't
have related side pages.)
| Field Summary | |
|---|---|
static Permission |
CONFIGURE
Permission to configure slaves. |
static Permission |
DELETE
|
static PermissionGroup |
PERMISSIONS
|
static ExecutorService |
threadPoolForRemoting
|
| Constructor Summary | |
|---|---|
Computer(Node node)
|
|
| Method Summary | |
|---|---|
void |
checkPermission(Permission permission)
Convenient short-cut for getACL().checkPermission(permission) |
void |
cliConnect(boolean force)
CLI command to reconnect this node. |
void |
cliDisconnect(String cause)
CLI command to disconnects this node. |
void |
cliOffline(String cause)
CLI command to mark the node offline. |
void |
cliOnline()
|
Future<?> |
connect(boolean forceReconnect)
Do the same as doLaunchSlaveAgent(StaplerRequest, StaplerResponse) but outside
the context of serving a request. |
int |
countBusy()
Returns the number of Executors that are doing some work right
now. |
int |
countExecutors()
Returns the current size of the executor pool for this computer. |
int |
countIdle()
Returns the number of idle Executors that can start working
immediately. |
static Computer |
currentComputer()
Gets the current Computer that the build is running. |
Future<?> |
disconnect()
Deprecated. as of 1.320. Use disconnect(OfflineCause) and
specify the cause. |
Future<?> |
disconnect(OfflineCause cause)
Disconnect this computer. |
void |
doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Accepts the update to the node configuration. |
org.kohsuke.stapler.HttpResponse |
doDeleteWithParam(org.kohsuke.stapler.StaplerRequest req)
Delete the slave. |
org.kohsuke.stapler.HttpResponse |
doDoDelete()
Really deletes the slave. |
void |
doDumpExportTable(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Dumps the contents of the export table. |
abstract void |
doLaunchSlaveAgent(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
If getChannel()==null, attempts to relaunch the slave agent. |
void |
doProgressiveLog(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Handles incremental log. |
void |
doRssAll(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
void |
doRssFailed(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
|
void |
doScript(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
For system diagnostics. |
void |
doScriptText(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
Run the arbitrary script and return result as plain text. |
org.kohsuke.stapler.HttpResponse |
doToggleOffline(String offlineMessage)
|
ACL |
getACL()
Obtains the ACL associated with this object. |
Api |
getApi()
|
RunList |
getBuilds()
|
int |
getBusyCount()
|
String |
getCaption()
|
abstract hudson.remoting.VirtualChannel |
getChannel()
Gets the channel that can be used to run a program on this computer. |
long |
getConnectTime()
Gets the time (since epoch) when this computer connected. |
abstract Charset |
getDefaultCharset()
Gets the default charset of this computer. |
long |
getDemandStartMilliseconds()
Returns the time when this computer first became in demand. |
String |
getDisplayName()
|
EnvVars |
getEnvironment()
Gets the environment variables of the JVM on this computer. |
Map<String,String> |
getEnvVars()
Deprecated. as of 1.292 Use getEnvironment() instead. |
List<Executor> |
getExecutors()
Gets the read-only snapshot view of all Executors. |
int |
getExecutorsCount()
|
RemotingDiagnostics.HeapDump |
getHeapDump()
Obtains the heap dump. |
String |
getHostName()
This method tries to compute the name of the host that's reachable by all the other nodes. |
String |
getIcon()
|
String |
getIconAltText()
|
int |
getIdleCount()
|
long |
getIdleStartMilliseconds()
Returns the time when this computer last became idle. |
LoadStatistics |
getLoadStatistics()
|
String |
getLog()
Gets the string representation of the slave log. |
abstract List<LogRecord> |
getLogRecords()
Gets the logs recorded by this slave. |
AnnotatedLargeText<Computer> |
getLogText()
Used to URL-bind AnnotatedLargeText. |
Map<String,Object> |
getMonitorData()
Expose monitoring data for the remote API. |
String |
getName()
Returns the name of the node. |
Node |
getNode()
Returns the Node that this computer represents. |
int |
getNumExecutors()
Number of Executors that are configured for this computer. |
OfflineCause |
getOfflineCause()
If the computer was offline (either temporarily or not), this method will return the cause. |
List<OneOffExecutor> |
getOneOffExecutors()
Gets the read-only snapshot view of all OneOffExecutors. |
int |
getOneOffExecutorsCount()
|
abstract RetentionStrategy |
getRetentionStrategy()
RetentionStrategy associated with this computer. |
List<AbstractProject> |
getRunningJobs()
Returns jobs that running on current computer. |
String |
getSearchUrl()
Returns the URL of this item relative to the parent SearchItem. |
Map<Object,Object> |
getSystemProperties()
Gets the system properties of the JVM on this computer. |
Map<String,String> |
getThreadDump()
Gets the thread dump of the slave JVM. |
List<AbstractProject> |
getTiedJobs()
Returns projects that are tied on this node. |
BuildTimelineWidget |
getTimeline()
|
String |
getUrl()
|
WorkspaceList |
getWorkspaceList()
Gets the object that coordinates the workspace allocation on this computer. |
boolean |
hasPermission(Permission permission)
Convenient short-cut for getACL().hasPermission(permission) |
void |
interrupt()
Interrupt all Executors. |
boolean |
isAcceptingTasks()
Returns true if the computer is accepting tasks. |
abstract boolean |
isConnecting()
Is a connect(boolean) operation in progress? |
boolean |
isIdle()
Returns true if all the executors of this computer are idle. |
boolean |
isJnlpAgent()
Deprecated. since 2008-05-18. See isLaunchSupported() and ComputerLauncher |
boolean |
isLaunchSupported()
Returns true if this computer can be launched by Hudson proactively and automatically. |
boolean |
isManualLaunchAllowed()
This method is called to determine whether manual launching of the slave is allowed at this point in time. |
boolean |
isOffline()
|
boolean |
isOnline()
|
boolean |
isTemporarilyOffline()
Deprecated. You should almost always want isOffline(). This
method is marked as deprecated to warn people when they accidentally call
this method. |
void |
launch()
Deprecated. since 2009-01-06. Use connect(boolean) |
void |
setTemporarilyOffline(boolean temporarilyOffline)
Deprecated. as of 1.320. Use setTemporarilyOffline(boolean, OfflineCause) |
void |
setTemporarilyOffline(boolean temporarilyOffline,
OfflineCause cause)
Marks the computer as temporarily offline. |
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 without any problems by an executor. |
| Methods inherited from class hudson.model.Actionable |
|---|
addAction, getAction, getAction, getActions, getActions, getDynamic |
| Methods inherited from class hudson.model.AbstractModelObject |
|---|
getSearch, getSearchIndex, getSearchName |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final ExecutorService threadPoolForRemoting
public static final PermissionGroup PERMISSIONS
public static final Permission CONFIGURE
public static final Permission DELETE
| Constructor Detail |
|---|
public Computer(Node node)
| Method Detail |
|---|
public WorkspaceList getWorkspaceList()
public String getLog()
throws IOException
IOExceptionpublic AnnotatedLargeText<Computer> getLogText()
AnnotatedLargeText.
public ACL getACL()
AccessControlled
getACL in interface AccessControlledpublic void checkPermission(Permission permission)
AccessControlledgetACL().checkPermission(permission)
checkPermission in interface AccessControlledpublic boolean hasPermission(Permission permission)
AccessControlledgetACL().hasPermission(permission)
hasPermission in interface AccessControlled@Exported public OfflineCause getOfflineCause()
public abstract hudson.remoting.VirtualChannel getChannel()
isOffline()==false.public abstract Charset getDefaultCharset()
isOffline()==false.
public abstract List<LogRecord> getLogRecords()
throws IOException,
InterruptedException
IOException
InterruptedException
public abstract void doLaunchSlaveAgent(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
getChannel()==null, attempts to relaunch the slave agent.
IOException
javax.servlet.ServletExceptionpublic final void launch()
connect(boolean)
public final Future<?> connect(boolean forceReconnect)
doLaunchSlaveAgent(StaplerRequest, StaplerResponse) 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.
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.
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.)disconnect()
@CLIMethod(name="connect-node")
public void cliConnect(boolean force)
throws ExecutionException,
InterruptedException
ExecutionException
InterruptedExceptionpublic final long getConnectTime()
public Future<?> disconnect(OfflineCause cause)
cause - Object that identifies the reason the node was disconnected.
Future to track the asynchronous disconnect operation.connect(boolean)public Future<?> disconnect()
disconnect(OfflineCause) and
specify the cause.
disconnect(null)
@CLIMethod(name="disconnect-node")
public void cliDisconnect(String cause)
throws ExecutionException,
InterruptedException
ExecutionException
InterruptedException
@CLIMethod(name="offline-node")
public void cliOffline(String cause)
throws ExecutionException,
InterruptedException
ExecutionException
InterruptedException
@CLIMethod(name="online-node")
public void cliOnline()
throws ExecutionException,
InterruptedException
ExecutionException
InterruptedException@Exported public int getNumExecutors()
Executors that are configured for this computer.
When this value is decreased, it is temporarily possible for
executors to have a larger number than this.
public String getName()
the name of the node.
public Node getNode()
Node that this computer represents.
Computer is not yet gone.@Exported public LoadStatistics getLoadStatistics()
public BuildTimelineWidget getTimeline()
public void taskAccepted(Executor executor,
Queue.Task task)
taskAccepted in interface ExecutorListenerexecutor - The executor.task - The task.
public void taskCompleted(Executor executor,
Queue.Task task,
long durationMS)
taskCompleted in interface ExecutorListenerexecutor - 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 ExecutorListenerexecutor - The executor.task - The task.durationMS - The number of milliseconds that the task took to
complete.problems - The exception that was thrown.@Exported public boolean isOffline()
public final boolean isOnline()
@Exported public boolean isManualLaunchAllowed()
true if manual launching of the slave is allowed at this
point in time.public abstract boolean isConnecting()
connect(boolean) operation in progress?
@Exported @Deprecated public boolean isJnlpAgent()
@Exported public boolean isLaunchSupported()
For example, JNLP slaves return false from this, because the
launch process needs to be initiated from the slave side.
@Exported public boolean isTemporarilyOffline()
isOffline(). This
method is marked as deprecated to warn people when they accidentally call
this method.
In contrast, isOffline() represents the actual
online/offline state. For example, this method may return false while
isOffline() returns true if the slave agent failed to launch.
public void setTemporarilyOffline(boolean temporarilyOffline)
setTemporarilyOffline(boolean, OfflineCause)
public void setTemporarilyOffline(boolean temporarilyOffline,
OfflineCause cause)
Channel connection, but prevent builds from executing.
cause - If the first argument is true, specify the reason why the
node is being put offline.@Exported public String getIcon()
public String getIconAltText()
@Exported public String getDisplayName()
getDisplayName in interface ModelObjectpublic String getCaption()
public String getUrl()
public List<AbstractProject> getTiedJobs()
public RunList getBuilds()
@Exported public List<AbstractProject> getRunningJobs()
public int getIdleCount()
public int countIdle()
Executors that can start working
immediately.
public final int countBusy()
Executors that are doing some work right
now.
public int getBusyCount()
public final int countExecutors()
getNumExecutors() if there
are busy tasks when the configured size is decreased. OneOffExecutors are
not included in this count.
public int getExecutorsCount()
public int getOneOffExecutorsCount()
@Exported public List<Executor> getExecutors()
Executors.
@Exported public List<OneOffExecutor> getOneOffExecutors()
OneOffExecutors.
@Exported public final boolean isIdle()
public final long getIdleStartMilliseconds()
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.
public final long getDemandStartMilliseconds()
public void interrupt()
Executors.
public String getSearchUrl()
SearchItemSearchItem.
getSearchUrl in interface SearchItempublic abstract RetentionStrategy getRetentionStrategy()
RetentionStrategy associated with this computer.
RetentionStrategy<? super T> where T=this.getClass().@Exported(inline=true) public Map<String,Object> getMonitorData()
public Map<Object,Object> getSystemProperties()
throws IOException,
InterruptedException
IOException
InterruptedException
public Map<String,String> getEnvVars()
throws IOException,
InterruptedException
getEnvironment() instead.
IOException
InterruptedException
public EnvVars getEnvironment()
throws IOException,
InterruptedException
IOException
InterruptedException
public Map<String,String> getThreadDump()
throws IOException,
InterruptedException
IOException
InterruptedException
public RemotingDiagnostics.HeapDump getHeapDump()
throws IOException
IOException
public String getHostName()
throws IOException,
InterruptedException
Since it's possible that the slave is not reachable from the master (it may be behind a firewall, connecting to master via JNLP), 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 slave, 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.
IOException
InterruptedException
public void doRssAll(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doRssFailed(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public org.kohsuke.stapler.HttpResponse doToggleOffline(@QueryParameter
String offlineMessage)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletExceptionpublic Api getApi()
public void doDumpExportTable(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
InterruptedException
IOException
javax.servlet.ServletException
InterruptedException
public void doScript(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doScriptText(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException
IOException
javax.servlet.ServletException
public void doConfigSubmit(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException,
javax.servlet.ServletException,
Descriptor.FormException
IOException
javax.servlet.ServletException
Descriptor.FormException
@CLIMethod(name="delete-node")
public org.kohsuke.stapler.HttpResponse doDoDelete()
throws IOException
IOException
public org.kohsuke.stapler.HttpResponse doDeleteWithParam(org.kohsuke.stapler.StaplerRequest req)
throws IOException,
javax.servlet.ServletException
req - StaplerRequest
IOException - if any.
javax.servlet.ServletException - if any.
public void doProgressiveLog(org.kohsuke.stapler.StaplerRequest req,
org.kohsuke.stapler.StaplerResponse rsp)
throws IOException
IOExceptionpublic static Computer currentComputer()
Computer that the build is running. This method
only works when called during a build, such as by
Publisher, BuildWrapper, etc.
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.
true if the computer is accepting tasks
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||