Temporal CLI workflow command reference
Workflow commands allow operations to be performed on Workflow Executions.
Workflow commands use this syntax:
temporal workflow COMMAND [ARGS]
.
cancel
The temporal workflow cancel
command cancels a Workflow Execution.
Canceling a running Workflow Execution records a WorkflowExecutionCancelRequested
event in the Event History.
A new Workflow Task will be scheduled, and the Workflow Execution performs cleanup work.
temporal workflow cancel --workflow-id=meaningful-business-id
In addition to Workflow IDs, Workflows can also be cancelled by a List Filter.
temporal workflow cancel --query=MyListFilter
Use the following options to change the behavior of this command.
count
The temporal workflow count
command returns a count of Workflow Executions.
This command requires Elasticsearch to be enabled.
Use the following options to change the command's behavior.
delete
The temporal workflow delete
command deletes the specified Workflow Execution.
Use the following options to change the command's behavior.
describe
The temporal workflow describe
command shows information about a given Workflow Execution.
This information can be used to locate Workflow Executions that weren't able to run successfully.
temporal workflow describe --workflow-id=meaningful-business-id
The output of this command can be changed to show as printed ('raw') or to only show the Workflow Execution's auto-reset points.
temporal workflow describe --workflow-id=meaningful-business-id --raw=true --reset-points=true
Use the following command options to change the information returned by this command.
execute
The temporal workflow execute
command starts a new Workflow Execution and prints its progress.
The command doesn't finish until the Workflow Execution completes.
To execute a Workflow from the Temporal CLI:
temporal workflow execute --workflow-id=meaningful-business-id --type=MyWorkflow --task-queue=MyTaskQueue
Single quotes('') are used to wrap input as JSON.
temporal workflow execute --workflow-id=meaningful-business-id --type-MyWorkflow --task-queue-MyTaskQueue --input='{"JSON": "Input"}'
Use the following command options to change how the Workflow Execution behaves during its run.
list
The temporal workflow list
command provides a list of Workflow Executions that meet the criteria of a given List Filter.
By default, this command returns a list of up to 10 closed Workflow Executions.
temporal workflow list --query=MyListFilter
The command can also return a list of archived Workflow Executions.
temporal workflow list --archived=true
Use the following command options to change the information returned by this command.
query
The temporal workflow query
command sends a Query to a Workflow Execution.
Queries can retrieve all or part of the Workflow state within given parameters. Queries can also be used on completed Workflows.
temporal workflow query --workflow-id=meaningful-business-id --type=MyQueryType
Use the following command options to change the information returned by this command.
reset
The temporal workflow reset
command resets a Workflow Execution.
A reset resumes the Workflow from a certain point without losing your parameters or Event History.
The Workflow Execution can be set to a given Event Type.
For example, temporal workflow reset --workflow-id=meaningful-business-id --type=LastContinuedAsNew
.
The Workflow Execution can also be reset to any Event after WorkflowTaskStarted.
For example, temporal workflow reset --workflow-id=meaningful-business-id --event-id=MyLastEvent
.
Use the following options to change reset behavior.
reset-batch
The temporal workflow reset-batch
command resets multiple Workflow Executions by resetType
.
Resetting a Workflow resumes it from a certain point without losing your parameters or Event History.
The set of Workflow Executions to reset can be specified in an input file. The input file must have a Workflow ID on each line.
temporal workflow reset-batch --input-file=MyInput --input-separator="\t"
Workflow Executions can also be queried by a List Filter.
temporal workflow reset-batch --query=MyListFilter
Use the following options to change reset behavior.
show
The temporal workflow show
command provides the Event History for a Workflow Execution.
Use the following options to change the behavior of this command.
signal
The temporal workflow signal
command is used to send a Signal to a Workflow Execution by Workflow Id or List Filter.
Use the following options to change the command's behavior.
stack
The temporal workflow stack
command queries a Workflow Execution with --stack-trace
as the Query type.
Returning the call stack of all the threads owned by a Workflow Execution can be great for troubleshooting in production.
Use the following options to change the command's behavior.
start
The temporal workflow start
command starts a new Workflow Execution.
When invoked successfully, the Workflow and Run ID are returned immediately after starting the Workflow.
temporal workflow start --task-queue=MyTaskQueue --type=MyWorkflow
Use the following command options to change how the Workflow Execution behaves upon starting.
terminate
The temporal workflow terminate
command terminates a Workflow Execution
Terminating a running Workflow Execution records a WorkflowExecutionTerminated
event as the closing Event in the Event History.
Any further Command Tasks cannot be scheduled after running this command.
Workflow terminations require a valid Workflow ID to function.
temporal workflow terminate --workflow-id=meaningful-business-id
Use the following options to change termination behavior.
trace
The temporal workflow trace
command tracks the progress of a Workflow Execution and any Child Workflows it generates.
Use the following options to change the command's behavior.
update
The temporal workflow update
command synchronously updates a running Workflow Execution.
Use the options listed below to change the command's behavior.