-
-
Save phucnh/9f0fc7da827a0d799e079556ed944062 to your computer and use it in GitHub Desktop.
Jenkins script to find dead executors and remove them.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// get handle to build output | |
def config = new HashMap() | |
def bindings = getBinding() | |
config.putAll(bindings.getVariables()) | |
def out = config['out'] | |
for (aSlave in hudson.model.Hudson.instance.slaves) { | |
// check if executor is dead | |
execList = aSlave.getComputer().getExecutors() | |
for( exec in execList ) { | |
if (exec.getCauseOfDeath()) { | |
println("\tSlave ${aSlave.name} has a dead executor.") | |
println("Error:") | |
exec.getCauseOfDeath().printStackTrace(out) | |
println('\n') | |
println("\tRemoving Dead Executor.") | |
exec.doYank() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment