@ThreadSafe public class EC2FleetAutoResubmitComputerLauncher extends hudson.slaves.DelegatingComputerLauncher
ComputerLauncher to get notification when slave was disconnected
and automatically resubmit Queue.Task if reason is unexpected termination
which usually means EC2 instance was interrupted.
This is optional feature, it's enabled by default, but could be disabled by
EC2FleetCloud.isDisableTaskResubmit()
EC2FleetNode,
EC2FleetNodeComputer| Constructor and Description |
|---|
EC2FleetAutoResubmitComputerLauncher(hudson.slaves.ComputerLauncher launcher) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterDisconnect(hudson.slaves.SlaveComputer computer,
hudson.model.TaskListener listener)
ComputerLauncher.afterDisconnect(SlaveComputer, TaskListener) |
beforeDisconnect, getLauncher, launchpublic EC2FleetAutoResubmitComputerLauncher(hudson.slaves.ComputerLauncher launcher)
public void afterDisconnect(hudson.slaves.SlaveComputer computer,
hudson.model.TaskListener listener)
ComputerLauncher.afterDisconnect(SlaveComputer, TaskListener)
EC2 Fleet plugin overrides this method to detect jobs which were failed because of EC2 instance was terminated/stopped. It could be manual stop or because of Spot marked. In all cases as soon as job aborted because of broken connection and slave is offline it will try to resubmit aborted job back to the queue, so user doesn't need to do that manually and another slave could take it.
Implementation details
There is no official recommendation about way how to resubmit job according to https://issues.jenkins-ci.org/browse/JENKINS-49707 moreover some of Jenkins code says it impossible.
method checks Computer.getOfflineCause() for disconnect because of EC2 instance termination
it returns
result = {OfflineCause$ChannelTermination@13708} "Connection was broken: java.io.IOException:
Unexpected termination of the channel\n\tat hudson.remoting.SynchronousCommandTransport$ReaderThread...
cause = {IOException@13721} "java.io.IOException: Unexpected termination of the channel"
timestamp = 1561067177837
afterDisconnect in class hudson.slaves.DelegatingComputerLaunchercomputer - computerlistener - listenerCopyright © 2016–2020. All rights reserved.