Temporal CLI schedule command reference
Schedule commands allow the user to create, use, and update Schedules. Schedules control when certain Actions for a Workflow Execution are performed, making it a useful tool for automation.
To run a Schedule command, run temporal schedule [command] [command options]
.
backfill
The temporal schedule backfill
command executes Actions ahead of their specified time range.
Backfilling adds Workflow Runs from a time period when the Schedule was paused, or from before the Schedule was created.
Schedule backfills require a valid Schedule ID, along with the time in which to run the Schedule and a change to the overlap policy. The following example fills in Workflow Runs from a point when the Schedule was paused.
temporal schedule backfill --schedule-id 'your-schedule-id' \
--overlap-policy 'BufferAll' \
--start-time '2022-05-0101T00:00:00Z' \
--end-time '2022-05-31T23:59:59Z'
Temporal recommends setting the Overlap Policy to BufferAll
to run backfilled Workflows sequentially.
Use the following options to change this command's behavior.
create
The temporal schedule create
command creates a new Schedule.
Newly created Schedules return a Schedule ID to be used in other Schedule commands.
Schedules use the following format:
temporal schedule create \
--schedule-id 'your-schedule-id' \
--workflow-id 'your-workflow-id' \
--task-queue 'your-task-queue' \
--workflow-type 'YourWorkflowType'
Actions are executed at the times specified in the Schedule. For example, the following Schedule starts a Workflow every 5 hours at 15 minutes past the hour. A Workflow is also started at 11:03 on Fridays.
temporal schedule create \
--schedule-id 'your-schedule-id' \
--interval '5h/15m' \
--calendar '{"dayOfWeek":"Fri","hour":"11","minute":"3"}' \
--overlap-policy 'BufferAll' \
--workflow-id 'your-workflow-id' \
--task-queue 'your-task-queue' \
--workflow-type 'YourWorkflowType'
Workflows don't run in parallel.
Setting the --overlap-policy
to BufferAll
allows Workflows to run sequentially if they would overlap.
Any combination of --calendar
, --interval
, and --cron
is supported.
Traditional cron strings, along with CronSchedule
features, are also supported.
temporal schedule create \
--schedule-id 'your-schedule-id' \
--cron '3 11 * * Fri' \
--workflow-id 'your-workflow-id' \
--task-queue 'your-task-queue' \
--workflow-type 'YourWorkflowType'
Use the following options to change this command's behavior.
delete
The temporal schedule delete
command deletes a Schedule.
Deleting a Schedule does not affect any Workflows started by the Schedule.
Workflow Executions started by Schedules can be cancelled or terminated like other Workflow Executions. However, Workflow Executions started by a Schedule can be identified by their Search Attributes, making them targetable by batch command for termination.
temporal schedule delete --schedule-id 'your-schedule-id' [command options]
Use the following options to change this command's behavior.
describe
The temporal schedule describe
command shows the current Schedule configuration.
This command also provides information about past, current, and future Workflow Runs.
temporal schedule describe --schedule-id 'your-schedule-id' [command options]
Use the following options to change this command's behavior.
list
The temporal schedule list
command lists all Schedule configurations.
Listing Schedules in Standard Visibility will only provide Schedule IDs.
temporal schedule list
Use the options below to change the behavior of this command.
toggle
The temporal schedule toggle
command can pause and unpause a Schedule.
Toggling a Schedule requires a reason to be entered on the command line.
Use --reason
to note the issue leading to the pause or unpause.
Schedule toggles are passed in this format:
temporal schedule toggle --schedule-id 'your-schedule-id' --pause --reason "paused because the database is down"
temporal schedule toggle --schedule-id 'your-schedule-id' --unpause --reason "the database is back up"
Use the following options to change this command's behavior.
trigger
The temporal schedule trigger
command triggers an immediate action with a given Schedule.
By default, this action is subject to the Overlap Policy of the Schedule.
Schedule triggers are passed in this format:
temporal schedule trigger
can be used to start a Workflow Run immediately.
temporal schedule trigger --schedule-id 'your-schedule-id'
The Overlap Policy of the Schedule can be overridden as well.
temporal schedule trigger --schedule-id 'your-schedule-id' --overlap-policy 'AllowAll'
Use the following options to change this command's behavior.
update
The temporal schedule update
command updates an existing Schedule.
Like temporal schedule create
, updated Schedules need to follow a certain format:
temporal schedule update \
--schedule-id 'your-schedule-id' \
--workflow-id 'your-workflow-id' \
--task-queue 'your-task-queue' \
--workflow-type 'YourWorkflowType'
Updating a Schedule takes the given options and replaces the entire configuration of the Schedule with what's provided. If you only change one value of the Schedule, be sure to provide the other unchanged fields to prevent them from being overwritten.
Use the following options to change the command's behavior.