tctl v1.17 workflow command reference
The tctl command line utility has been deprecated and is no longer actively supported. We recommend transitioning to Temporal CLI for continued use and access to new features.
Thank you for being a valued part of the Temporal community.
The tctl workflow
commands enable Workflow Execution operations.
- tctl workflow cancel
- tctl workflow count
- tctl workflow describe
- tctl workflow describeid
- tctl workflow list
- tctl workflow listall
- tctl workflow listarchived
- tctl workflow observe
- tctl workflow observeid
- tctl workflow query
- tctl workflow reset
- tctl workflow reset-batch
- tctl workflow run
- tctl workflow scan
- tctl workflow show
- tctl workflow showid
- tctl workflow signal
- tctl workflow stack
- tctl workflow start
- tctl workflow terminate
cancel
The tctl workflow cancel --query
command cancels a Workflow Execution.
Canceling a running Workflow Execution records a WorkflowExecutionCancelRequested
event in the History.
A new Workflow Task will be scheduled.
After cancellation, the Workflow Execution can perform cleanup work.
See also tctl workflow terminate --query
.
tctl workflow cancel --query <query> <modifiers>
The following modifiers control the behavior of the command.
--workflow_id
Specify a Workflow Id.
Alias: -w
Example
tctl workflow cancel --workflow_id <id>
--run_id
Specify a Run Id.
Alias: -r
Example
tctl workflow cancel --run_id <id>
count
The tctl workflow count
command counts Workflow Executions.
This command requires Elasticsearch to be enabled.
tctl workflow count <modifiers>
The following modifier controls the behavior of the command.
--query
Required modifier
Specify an SQL-like query of Search Attributes.
Alias: -q
Example
To count all open Workflow Executions:
tctl workflow count --query 'ExecutionStatus="Running"'
describe
The tctl workflow describe
command shows information about a Workflow Execution.
This information can be used to locate a failed Workflow Execution, for example.
To find a Workflow with a given Run Id, refer to tctl workflow describeid
.
tctl workflow describe <modifiers>
The following modifiers control the behavior of the command. Always include required modifiers when executing this command.
--workflow_id
This is a required modifier.
Specify a Workflow Id.
Alias: -w
Example
tctl workflow describe --workflow_id <id>
--run_id
Specify a Run Id. If a Run Id is not provided, the command will show the latest Workflow Execution of that Workflow Id.
Alias: -r
Example
tctl workflow describe --run_id <id>
--print_raw
Print properties exactly as they are stored.
Example
tctl workflow describe --print_raw
--reset_points_only
Show only events that are eligible for reset. If successful, the command returns the Run Id of all deployments, and the times at which the Events were created.
Example
tctl workflow describe --reset_points_only
describeid
The tctl workflow describeid
command shows information about a Workflow Execution for the specified Workflow Id and optional Run Id.
tctl workflow describeid <workflow_id> <run_id> <modifiers>
This command is a shortcut for tctl workflow describe --workflow_id <workflowid> --run_id <runid>
.
The following modifiers control the behavior of the command.
--print_raw
Print properties exactly as they are stored.
Example
tctl workflow describeid <workflow_id> <id> --print_raw
--reset_points_only
Show only events that are eligible for reset.
Example
tctl workflow describeid <workflow_id> --reset_points_only
list
The tctl workflow list
command lists open or closed Workflow Executions.
By default, this command lists a maximum of 10 closed Workflow Executions.
- To set the size of a page, use the
--pagesize
option. - To list multiple pages, use the
--more
option. - To list open Workflow Executions, use the
--open
option.
See also tctl workflow listall
, tctl workflow listarchived
, and tctl workflow scan
.
tctl workflow list <modifiers>
The following modifiers control the behavior of the command.
--print_raw_time
Print the raw timestamp.
Example
tctl workflow list --print_raw_time
--print_datetime
Print the timestamp.
Example
tctl workflow list --print_datetime
--print_memo
Print a memo.
Example
tctl workflow list --print_memo
--print_search_attr
Print the Search Attributes.
Example
tctl workflow list --print_search_attr
--print_full
Print the full message without table formatting.
Example
tctl workflow list --print_full
--print_json
Print the raw JSON objects.
Example
tctl workflow list --print_json
--open
List open Workflow Executions.
(By default, the tctl workflow list
command lists closed Workflow Executions.)
Example
tctl workflow list --open
--earliest_time
Specify the earliest start time to list. Supported format are as follows:
<year>-<month>-<day>T<hour>:<minute>:<second><+|-><offsethours>:<offsetminutes>
- Raw Unix Epoch time (the number of milliseconds since 0000 UTC on January 1, 1970).
<n><duration
, where<n>
is a value between 0 and 1000000, and<duration>
is one of the following:second
ors
minute
orm
hour
orh
day
ord
week
orw
month
orM
year
ory
Examples
To specify 3:04:05 PM India Standard Time on January 2, 2022:
tctl workflow list --earliest-time '2022-01-02T15:04:05+05:30'
To specify 15 minutes before the current time:
tctl workflow list --earliest-time '15minute'
--latest_time
Specify the latest start time to list. Supported formats are as follows:
<year>-<month>-<day>T<hour>:<minute>:<second><+|-><offsethours>:<offsetminutes>
- Raw Unix Epoch time (the number of milliseconds since 0000 UTC on January 1, 1970).
<n><duration
, where<n>
is a value between 0 and 1000000, and<duration>
is one of the following:second
ors
minute
orm
hour
orh
day
ord
week
orw
month
orM
year
ory
Examples
To specify 11:02:17 PM Pacific Daylight Time on April 13, 2022:
tctl workflow list --latest_time '2022-04-13T23:02:17-07:00'
To specify 10s before the current time:
tctl workflow list --latest_time '10second'
--workflow_id
Specify a Workflow Id.
Alias: -w
Example
tctl workflow list --workflow_id <id>
--workflow_type
Specify the name of a Workflow Type.
Example
tctl workflow list --workflow_type <name>
--status
Specify the status of a Workflow Execution. Supported values are as follows:
completed
failed
canceled
terminated
continuedasnew
timedout
Example
tctl workflow list --status <value>
--query
How to list and filter Workflow Executions with a List Filter using tctl.
The --query
flag is supported only when Advanced Visibility is configured with the Cluster.
Using the --query
option causes tctl to ignore all other filter options, including open
, earliest_time
, latest_time
, workflow_id
, and workflow_type
.
Alias: -q
Example
tctl workflow list --query "WorkflowId=<your-workflow-id>"
More examples:
tctl workflow list \
--query "WorkflowType='main.SampleParentWorkflow' AND ExecutionStatus='Running'"
tctl workflow list \
--query '(CustomKeywordField = "keyword1" and CustomIntField >= 5) or CustomKeywordField = "keyword2"' \
--print_search_attr
tctl workflow list \
--query 'CustomKeywordField in ("keyword2", "keyword1") and CustomIntField >= 5 and CloseTime between "2018-06-07T16:16:36-08:00" and "2019-06-07T16:46:34-08:00" order by CustomDatetimeField desc' \
--print_search_attr
tctl workflow list \
--query 'WorkflowType = "main.Workflow" and (WorkflowId = "1645a588-4772-4dab-b276-5f9db108b3a8" or RunId = "be66519b-5f09-40cd-b2e8-20e4106244dc")'
tctl workflow list \
--query 'WorkflowType = "main.Workflow" StartTime > "2019-06-07T16:46:34-08:00" and ExecutionStatus = "Running"'
--more
List more than one page.
(By default, the tctl workflow list
command lists one page of results.)
Example
tctl workflow list --more
--pagesize
Specify the maximum number of Workflow Executions to list on a page.
(By default, the tctl workflow list
command lists 10 Workflow Executions per page.)
Example
tctl workflow list --pagesize <value>
listall
The tctl workflow listall
command lists all open or closed Workflow Executions.
By default, this command lists all closed Workflow Executions.
To list open Workflow Executions, use the --open
option.
See also tctl workflow list
, tctl workflow listarchived
, and tctl workflow scan
.
tctl workflow listall <modifiers>
The following modifiers control the behavior of the command.
###`--print_raw_time
Print the raw timestamp.
Example
tctl workflow listall --print_raw_time
--print_datetime
Print the timestamp.
Example
tctl workflow listall --print_datetime
--print_memo
Print a memo.
Example
tctl workflow listall --print_memo
--print_search_attr
Print the Search Attributes.
Example
tctl workflow listall --print_search_attr
--print_full
Print the full message without table formatting.
Example
tctl workflow listall --print_full
--print_json
Print the raw JSON objects.
Example
tctl workflow listall --print_json
--open
List open Workflow Executions.
(By default, the tctl workflow listall
command lists closed Workflow Executions.)
Example
tctl workflow listall --open
--earliest_time
Specify the earliest start time to list. Supported format are as follows:
<year>-<month>-<day>T<hour>:<minute>:<second><+|-><offsethours>:<offsetminutes>
- Raw Unix Epoch time (the number of milliseconds since 0000 UTC on January 1, 1970).
<n><duration
, where<n>
is a value between 0 and 1000000, and<duration>
is one of the following:second
ors
minute
orm
hour
orh
day
ord
week
orw
month
orM
year
ory
Examples
To specify 3:04:05 PM India Standard Time on January 2, 2022:
tctl workflow listall --earliest-time '2022-01-02T15:04:05+05:30'
To specify 15 minutes before the current time:
tctl workflow listall --earliest-time '15minute'
--latest_time
Specify the latest start time to list. Supported formats are as follows:
<year>-<month>-<day>T<hour>:<minute>:<second><+|-><offsethours>:<offsetminutes>
- Raw Unix Epoch time (the number of milliseconds since 0000 UTC on January 1, 1970).
<n><duration
, where<n>
is a value between 0 and 1000000, and<duration>
is one of the following:second
ors
minute
orm
hour
orh
day
ord
week
orw
month
orM
year
ory
Alias: --lt
Examples
To specify 11:02:17 PM Pacific Daylight Time on April 13, 2022:
tctl workflow listall --latest-time '2022-04-13T23:02:17-07:00'
To specify 10 seconds before the current time:
tctl workflow listall --latest-time '10second'
--workflow_id
Specify a Workflow Id.
Alias: -w
Example
tctl workflow listall --workflow_id <id>
--workflow_type
Specify the name of a Workflow Type.
Example
tctl workflow listall --workflow_type <name>
--status
Specify the status of a Workflow Execution. Supported values are as follows:
completed
failed
canceled
terminated
continuedasnew
timedout
Example
tctl workflow listall --status <value>
--query
Specify an SQL-like query of Search Attributes.
Using the --query
option causes tctl to ignore all other filter options, including open
, earliest_time
, latest_time
, workflow_id
, and workflow_type
.
Alias: -q
Example
tctl workflow listall --query <value>
listarchived
The tctl workflow listarchived
command lists archived Workflow Executions.
By default, this command lists a maximum of 100 Workflow Executions.
- To set the size of a page, use the
--pagesize
option. - To list all pages, use the
--all
option.
See also tctl workflow list
, tctl workflow listall
, and tctl workflow scan
.
tctl workflow listarchived <modifiers>
The following modifiers control the behavior of the command.
--print_raw_time
Print the raw timestamp.
Example
tctl workflow listarchived --print_raw_time
--print_datetime
Print the timestamp.
Example
tctl workflow listarchived --print_datetime
--print_memo
Print a memo.
Example
tctl workflow listarchived --print_memo
--print_search_attr
Print the Search Attributes.
Example
tctl workflow listarchived --print_search_attr
--print_full
Print the full message without table formatting.
Example
tctl workflow listarchived --print_full
--print_json
Print the raw JSON objects.
Example
tctl workflow listarchived --print_json
--query
Specify an SQL-like query of Search Attributes.
Consult the documentation of the visibility archiver that is used by your Namespace for detailed instructions.
Alias: -q
Example
tctl workflow listarchived --query <value>
--pagesize
Specify the maximum number of Workflow Executions to list on a page.
(By default, the tctl workflow listarchived
command lists 100 Workflow Executions per page.)
Example
tctl workflow listarchived --pagesize <value>
--all
List all pages.
Example
tctl workflow listarchived --all
observe
The tctl workflow observe
command shows the progress of the Event History of a Workflow Execution.
See also tctl workflow observeid
.
tctl workflow observe <modifiers>
Alias: o
The following modifiers control the behavior of the command.
--workflow_id
Specify a Workflow Id.
Alias: -w
Example
tctl workflow observe --workflow_id <id>
--run_id
Specify a Run Id.
Alias: -r
Example
tctl workflow observe --run_id <id>
--show_detail
Show event details.
Example
tctl workflow observe --show_detail
--max_field_length
Specify the maximum length for each attribute field. The default value is 0.
Example
tctl workflow observe --max_field_length <length>
observeid
The tctl workflow observeid
command shows the progress of the Event History of a Workflow Execution for the specified Workflow Id and optional Run Id.
tctl workflow observeid <workflow_id> [<run_id>] <modifiers>
This command is a shortcut for tctl workflow observe --workflow_id <workflowid> [--run_id <runid>]
.
The following modifiers control the behavior of the command.
--show_detail
Show event details.
Example
tctl workflow observeid --show_detail
--max_field_length
Specify the maximum length for each attribute field. The default value is 0.
Example
tctl workflow observeid --max_field_length <length>
query
Alias: q
The tctl workflow query
command sends a Query to a Workflow Execution.
Queries can be used to retrieve all or part of the Workflow state with given parameters.
$ tctl workflow query --workflow_id "HelloQuery" --query_type "getCount"
Query result as JSON:
3
Queries can also be used on completed Workflows. Let's complete a Workflow by updating its greeting, and then query the now-finished Workflow.
$ tctl workflow signal --workflow_id "HelloQuery" --name "updateGreeting" --input \"Bye\"
Signal workflow succeeded.
$ tctl workflow query --workflow_id "HelloQuery" --query_type "getCount"
Query result as JSON:
4
Queries are written as follows:
tctl workflow query --workflow_id [modifiers]
The following modifiers control the behavior of the command. Always include required modifiers when executing this command.
--workflow_id
Specify a Workflow Id. This modifier is required.
Alias: -w
Example
tctl workflow query --workflow_id <id>
--run_id
Specify a Run Id.
Alias: -r
Example
tctl workflow query --run_id <id>
--query_type
Specify the type of Query to run.
Example
tctl workflow query --query_type <value>