4
votes

I am running a Selenium test suite on ec2 windows instances. These instances should be restarted once every few days as maintenance to free up memory etc.

The problem I have is when I send the restart-command to the slave from Jenkins, I can´t be certain that the slave have no running jobs at that time, since the slave run several executors.

Is there a way to tell a node that, as soon as job X is triggered, drop the amount of executors to 0? If not, is there a way to gracefully put a slave offline (i.e: "complete all jobs in que but don´t accept any new jobs")?

1
You have more than one question it seems, 1. how do you schedule the restart seamlessly, 2. how do you shutdown a slave. A possibility for #1 would be to create a new job that runs periodically every couple of days that takes up N executors where N is the maximum number of executors and runs on a particular node you specify. You can then set up a build matrix that covers all of the nodes. As far as #2 how to actually restart the node, depending on the OS you would then just run a reboot command. - hofan41
one way could be to run a daemon on the slave that reports to a server whether or not it is still running a job - doles

1 Answers

-1
votes

(jenkins_url)/safeRestart - Allows all running jobs to complete. New jobs will remain in the queue to run after the restart is complete.