Magpie clusters can be scheduled to start, stop, or restart at specific times with cluster schedules. A cluster schedule requires a user account with write permission or above on the cluster. This may be the schedule creator or a service account specified by the creator.
Clusters have three action types: Start, Stop, and Restart. A cluster will only be started as scheduled if it is in a stopped state. A cluster will only be stopped or restarted if in a started state.
The following command shows a schedule to restart the cluster named main_cluster at 1500 UTC:
alter cluster main_cluster add schedule {
"name": "restart_schedule",
"description": "schedule to restart main_cluster",
"expression": "0 0 15 * * ?",
"userName": "sahil.sangwan+1@silect.is",
"clusterAction": "Restart",
"timeZone": UTC
}
The above schedule will restart the cluster (if it is started) at 1500 UTC. To see the details all cluster schedules, describe the cluster and select the “Schedules” tab:
Cluster schedule cron expressions must have a fixed integer value in the range 0-59 for the minutes and hours. You cannot execute one cluster schedule more frequently than once per hour. However, a user may manually take any action on a cluster at any time, regardless of schedules.
It is recommended to use cluster schedules to trigger cluster actions at fixed times of day, and to ensure these times are several hours apart. Use daylight-sensitive Java time zone IDs (such as America/New_York for eastern time) to automatically adjust cluster schedule execution after time changes.