In this recipe, we will learn how to persist framework state between restarts.
Every time we restart our framework, it starts from scratch, losing all information about the tasks it's scheduled. After the framework goes down, Mesos kills all its tasks. This behavior is not acceptable when we want to upgrade the framework without restarting its tasks. To change this, we must do two things: tell Mesos to keep tasks after framework communication fails, and keep framework state between restarts.
In the main()
function, declare the variable holding the framework failover seconds and checkpointing
flag:
failoverTimeout := float64(3600) checkpoint := true
We will use them in the framework info declaration.
Then we need to store the framework info and task state. The framework info is changed only after the subscribe
method. After subscription, it's worthwhile saving, since it contains a framework that is required to reconnect.
Declare a global variable with a path to...