tctl
tctl copied to clipboard
Provide a simple way to run common batch jobs on workflows
Is your feature request related to a problem? Please describe.
A common ask from developers is to be able to terminate all running workflows using tctl.
What most devs end up doing is running something like the following (with current gen tctl):
tctl workflow list --open --more | awk '{ print $3 }' | tail -n +2 | grep -v to | xargs -n 1 tctl workflow terminate --workflow_id
There's also a less known option if enhanced visibility is enabled documented here: https://docs.temporal.io/docs/system-tools/tctl/#signal-cancel-terminate-workflows-as-a-batch-job. This option doesn't provide a great DX when you just want to nuke everything for local development.
Describe the solution you'd like
@mfateev suggested an alternative where tctl commands would accept a --query flag to start and await batch completion.
tctl wf terminate --workflow-id ...
tctl wf terminate --query "ExecutionStatus='Running'"
I'd further like:
tctl workflow terminate --all
probably with a confirmation dialog:
⚠️ Are you sure you'd like to terminate all workflows?
This is my most common tctl use case.