Class EC2SpotInterruptionMonitor

All Implemented Interfaces:
ExtensionPoint, Runnable

@Extension public class EC2SpotInterruptionMonitor extends PeriodicWork
Retires spot agents that EC2 has given notice on.

An interrupted instance has about two minutes left. Work handed to it in that window is work that will be lost, so an agent under notice is taken out of service straight away and terminated once whatever it was already running has finished. A build that is already under way cannot be saved, but nothing new needs to be thrown after it.

The notice is read from the instance rather than from EC2. It is the same signal AWS documents for the purpose, it arrives without waiting for an API to catch up, and asking costs nothing that counts against an API limit, which matters when the question is asked of every agent every few seconds. An on-demand instance simply answers that there is no notice.

  • Constructor Details

    • EC2SpotInterruptionMonitor

      public EC2SpotInterruptionMonitor()
  • Method Details