How to Save State When Preempted on a Google Preemptible Instance

Is there a way to restart pre-emptible Google Cloud VM instances (Compute Engine) on an hourly basis if it has stopped?

Per this document, Compute Engine always terminates preemptible instances after they run for 24 hours. If you start or shut down the instance via the click “start” or “stop” button in the Google Cloud Console instance page, these actions will reset the 24-hour counter for preemptible instances.

If your science jobs always run longer than 24 hours, and you want to avoid jobs being interrupted, or if you want restart your preemptible instance hourly, you can use Cloud scheduler to start or stop your instance at a fixed time.

How do I automatically restart a GCE preemptible instance?

You could try using Instance Group Manager to set up a pool of size 1. It will then try to re-create instances after they are preempted.

You should be aware that there is no guarantee that there is going to be capacity for your instance. As the docs say:

Preemptible instances are available from a finite amount of Compute Engine resources, and might not always be available.



Related Topics



Leave a reply



Submit