How to get a list workflows based on some filtering, like timeout/workflowType

612 Views Asked by At

From https://github.com/uber/cadence/issues/3820

It's command that people want to get a list of workflows based on some filtering. For example to get a list of workflows to reset or any operation.

1

There are 1 best solutions below

0
On

In WebUI, you can select by the dropdown for "timeout" workflows.

With CLI, you can use command:

./cadence --domain sample-domain wf list --status timeout 

you add filtering on workflow type:

./cadence --domain sample-domain wf list --wt "MyWorkflow" --status timeout 

If you have advanced visibility, you and have more customize query:

./cadence --domain sample-domain wf list --query "CloseStatus=5 AND SOME_OTHER_FILTERS"

Feel free to explore more options in using List command with ``:

./cadence --domain sample-domain wf list --help
NAME:
   cadence workflow list - list open or closed workflow executions

USAGE:
   cadence workflow list [command options] [arguments...]

DESCRIPTION:
   list one page (default size 10 items) by default, use flag --pagesize to change page size

OPTIONS:
   --print_raw_time, --prt                     Print raw timestamp
   --print_datetime, --pdt                     Print full date time in '2006-01-02T15:04:05Z07:00' format
   --print_memo, --pme                         Print memo
   --print_search_attr, --psa                  Print search attributes
   --print_full, --pf                          Print full message without table format
   --print_json, --pjson                       Print in raw json format
   --open, --op                                List for open workflow executions, default is to list for closed ones
   --earliest_time value, --et value           EarliestTime of start time, supported formats are '2006-01-02T15:04:05+07:00', raw UnixNano and time range (N<duration>), where 0 < N < 1000000 and duration (full-notation/short-notation) can be second/s, minute/m, hour/h, day/d, week/w, month/M or year/y. For example, '15minute' or '15m' implies last 15 minutes.
   --latest_time value, --lt value             LatestTime of start time, supported formats are '2006-01-02T15:04:05+07:00', raw UnixNano and time range (N<duration>), where 0 < N < 1000000 and duration (in full-notation/short-notation) can be second/s, minute/m, hour/h, day/d, week/w, month/M or year/y. For example, '15minute' or '15m' implies last 15 minutes
   --workflow_id value, --wid value, -w value  WorkflowID
   --workflow_type value, --wt value           WorkflowTypeName
   --status value, -s value                    Closed workflow status [completed, failed, canceled, terminated, continuedasnew, timedout]
   --query value, -q value                     Optional SQL like query for use of search attributes. NOTE: using query will ignore all other filter flags including: [open, earliest_time, latest_time, workflow_id, workflow_type]
   --more, -m                                  List more pages, default is to list one page of default page size 10
   --pagesize value, --ps value                Result page size (default: 10)