Package hudson.plugins.ec2
Class EC2Computer
- java.lang.Object
-
- hudson.model.AbstractModelObject
-
- hudson.model.Actionable
-
- hudson.model.Computer
-
- hudson.slaves.SlaveComputer
-
- hudson.plugins.ec2.EC2Computer
-
- All Implemented Interfaces:
ExtensionPoint
,DescriptorByNameOwner
,ExecutorListener
,ModelObject
,SearchableModelObject
,SearchItem
,AccessControlled
,ModelObjectWithContextMenu
,HasWidgets
,org.kohsuke.stapler.StaplerProxy
public class EC2Computer extends SlaveComputer
- Author:
- Kohsuke Kawaguchi
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class hudson.model.Computer
Computer.DisplayExecutor, Computer.TerminationRequest
-
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
-
Fields inherited from class hudson.slaves.SlaveComputer
ALLOW_UNSUPPORTED_REMOTING_VERSIONS
-
Fields inherited from class hudson.model.Computer
BUILD, CONFIGURE, CONNECT, CREATE, DELETE, DISCONNECT, EXTENDED_READ, EXTENDED_READ_AND_CONNECT, nodeName, offlineCause, PERMISSIONS, SKIP_PERMISSION_CHECK, statusChangeLock, threadPoolForRemoting, transientActions
-
-
Constructor Summary
Constructors Constructor Description EC2Computer(EC2AbstractSlave slave)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description com.amazonaws.services.ec2.model.Instance
describeInstance()
Obtains the instance state description in EC2.org.kohsuke.stapler.HttpResponse
doDoDelete()
When the agent is deleted, terminate the instance.EC2Cloud
getCloud()
String
getConsoleOutput()
Gets the EC2 console output.String
getDecodedConsoleOutput()
Gets the EC2 decoded console output.String
getEc2Type()
String
getInstanceId()
long
getLaunchTime()
Return the time this instance was launched in ms since the epoch.EC2AbstractSlave
getNode()
String
getRemoteAdmin()
What username to use to run root-like commandsString
getRootCommandPrefix()
String
getSlaveCommandPrefix()
String
getSlaveCommandSuffix()
SlaveTemplate
getSlaveTemplate()
String
getSpotInstanceRequestId()
int
getSshPort()
InstanceState
getState()
Gets the current state of the instance.long
getUptime()
Number of milli-secs since the instance was started.String
getUptimeString()
Returns uptime in the human readable form.void
onConnected()
com.amazonaws.services.ec2.model.Instance
updateInstanceDescription()
This will flush any cached description held bydescribeInstance()
.-
Methods inherited from class hudson.slaves.SlaveComputer
_connect, disconnect, doDoDisconnect, doJenkinsAgentJnlp, doLaunchSlaveAgent, doSlaveAgentJnlp, doSubmitDescription, getAbsoluteRemoteFs, getAbsoluteRemotePath, getChannel, getChannelToMaster, getClassLoadingCount, getClassLoadingPrefetchCacheCount, getClassLoadingTime, getDefaultCharset, getDelegatedLauncher, getEnvVarsFull, getIconClassName, getJnlpJars, getJnlpMac, getLauncher, getListener, getLogRecords, getOSDescription, getResourceLoadingCount, getResourceLoadingTime, getRetentionStrategy, getSlaveVersion, getSystemInfoExtensions, getTarget, grabLauncher, isAcceptingTasks, isConnecting, isJnlpAgent, isLaunchSupported, isUnix, kill, openLogFile, setAcceptingTasks, setChannel, setChannel, setChannel, setChannel, setNode, taskAccepted, taskCompleted, taskCompletedWithProblems, taskStarted, tryReconnect
-
Methods inherited from class hudson.model.Computer
_doScript, addAction, buildEnvironment, cliConnect, cliDisconnect, cliOffline, cliOnline, connect, countBusy, countExecutors, countIdle, currentComputer, disconnect, doChangeOfflineCause, doConfigDotXml, doConfigSubmit, doDumpExportTable, doProgressiveLog, doRssAll, doRssFailed, doRssLatest, doScript, doScriptText, doToggleOffline, getACL, getActions, getAllExecutors, getApi, getAssignedLabels, getBuilds, getCaption, getComputerPanelBoxs, getConnectTime, getDemandStartMilliseconds, getDescription, getDisplayExecutors, getDisplayName, getEnvironment, getEnvVars, getExecutors, getHeapDump, getHostName, getIcon, getIconAltText, getIdleStartMilliseconds, getLoadStatistics, getLog, getLogDir, getLogFile, getLogText, getMonitorData, getName, getNumExecutors, getOfflineCause, getOfflineCauseReason, getOneOffExecutors, getSearchUrl, getSystemProperties, getTerminatedBy, getThreadDump, getTiedJobs, getTimeline, getUrl, getWorkspaceList, interrupt, isAlive, isIdle, isManualLaunchAllowed, isOffline, isOnline, isPartiallyIdle, isTemporarilyOffline, launch, onRemoved, recordTermination, relocateOldLogs, removeExecutor, resolveForCLI, setTemporarilyOffline, setTemporarilyOffline, updateByXml, waitUntilOffline, waitUntilOnline
-
Methods inherited from class hudson.model.Actionable
addOrReplaceAction, doContextMenu, getAction, getAction, getActions, getAllActions, getDynamic, removeAction, removeActions, replaceAction, replaceActions
-
Methods inherited from class hudson.model.AbstractModelObject
getSearch, getSearchIndex, getSearchName, makeSearchIndex, requirePOST, 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 jenkins.widgets.HasWidgets
getWidget, getWidgets
-
-
-
-
Constructor Detail
-
EC2Computer
public EC2Computer(EC2AbstractSlave slave)
-
-
Method Detail
-
getNode
public EC2AbstractSlave getNode()
- Overrides:
getNode
in classSlaveComputer
-
getInstanceId
@CheckForNull public String getInstanceId()
-
getEc2Type
public String getEc2Type()
-
getSpotInstanceRequestId
public String getSpotInstanceRequestId()
-
getCloud
public EC2Cloud getCloud()
-
getSlaveTemplate
@CheckForNull public SlaveTemplate getSlaveTemplate()
-
getConsoleOutput
public String getConsoleOutput() throws com.amazonaws.AmazonClientException
Gets the EC2 console output.- Throws:
com.amazonaws.AmazonClientException
-
getDecodedConsoleOutput
public String getDecodedConsoleOutput() throws com.amazonaws.AmazonClientException
Gets the EC2 decoded console output.- Throws:
com.amazonaws.AmazonClientException
- Since:
- TODO
-
describeInstance
public com.amazonaws.services.ec2.model.Instance describeInstance() throws com.amazonaws.AmazonClientException, InterruptedException
Obtains the instance state description in EC2.This method returns a cached state, so it's not suitable to check
Instance.getState()
from the returned instance (but all the other fields are valid as it won't change.) The cache can be flushed usingupdateInstanceDescription()
- Throws:
com.amazonaws.AmazonClientException
InterruptedException
-
updateInstanceDescription
public com.amazonaws.services.ec2.model.Instance updateInstanceDescription() throws com.amazonaws.AmazonClientException, InterruptedException
This will flush any cached description held bydescribeInstance()
.- Throws:
com.amazonaws.AmazonClientException
InterruptedException
-
getState
public InstanceState getState() throws com.amazonaws.AmazonClientException, InterruptedException
Gets the current state of the instance.Unlike
describeInstance()
, this method always return the current status by calling EC2.- Throws:
com.amazonaws.AmazonClientException
InterruptedException
-
getUptime
public long getUptime() throws com.amazonaws.AmazonClientException, InterruptedException
Number of milli-secs since the instance was started.- Throws:
com.amazonaws.AmazonClientException
InterruptedException
-
getUptimeString
public String getUptimeString() throws com.amazonaws.AmazonClientException, InterruptedException
Returns uptime in the human readable form.- Throws:
com.amazonaws.AmazonClientException
InterruptedException
-
getLaunchTime
public long getLaunchTime() throws InterruptedException
Return the time this instance was launched in ms since the epoch.- Returns:
- Time this instance was launched, in ms since the epoch.
- Throws:
InterruptedException
-
doDoDelete
@POST public org.kohsuke.stapler.HttpResponse doDoDelete() throws IOException
When the agent is deleted, terminate the instance.- Overrides:
doDoDelete
in classComputer
- Throws:
IOException
-
getRemoteAdmin
@CheckForNull public String getRemoteAdmin()
What username to use to run root-like commands- Returns:
- remote admin or
null
if the associatedNode
isnull
-
getSshPort
public int getSshPort()
-
getRootCommandPrefix
public String getRootCommandPrefix()
-
getSlaveCommandPrefix
public String getSlaveCommandPrefix()
-
getSlaveCommandSuffix
public String getSlaveCommandSuffix()
-
onConnected
public void onConnected()
-
-