Nomad
schedule block in the job specification
| Placement | job -> group -> task -> periodic |
Time based task execution is enabled by using the schedule block. The
schedule block controls when a task is allowed to be running.
Enterprise
This feature requires Nomad Enterprise(opens in new tab).
Note: Time based task execution is an experimental feature and subject to change. This feature is supported for select customers. Please refer to the Upgrade Guide to find breaking changes.
Unlike periodic jobs, the schedule block applies to individual
tasks. The Nomad Client starts and stops tasks at the specified time without
interaction with the Nomad Servers. This means time based task execution works
even when a Client is disconnected from Servers. The task's resources remain
allocated even outside the schedule when the task itself is stopped.
job "docs" {
group "tbte" {
task "scheduled" {
schedule {
cron {
start = "30 9 * * MON-FRI *"
end = "0 16"
timezone = "America/New_York"
}
}
}
}
}
Parameters
The schedule block must have a cron block containing:
start(string: <required>)- When the task should be started. Specified in 6 field cron format (no seconds) without,or/characters.end(string: <required>)- When the task should be stopped (kill_signalandkill_timeoutapply). Specified in 2 field cron format (minute and hour) without,or/characters.timezone(string: "Local")- What time zone thestartandendtimes are specified in. Defaults to the local time zone of the Nomad Client the job is scheduled onto.
Limitations
Job deployments outside of the specified
schedulewill be unable to succeed. To update a job using time based task execution outside of its schedule, do a force update.Overnight schedules are currently not supported. Adjusting the
timezoneshould allow converting overnight schedules to times within a single day.