Fetch Workflow status for a batch of Workflow IDs

Hi team,

I have a similar use case as that of Workflow status in batch Describe, where we want to know the workflow status of N workflows. We were using describeWorkflowExecution for each of the workflow, but this is taking more time and Iā€™m looking for ways to optimise this. Is there a way that we can get the status of all the N workflow Ids in one call?

TIA!

What do you mean by status? The list API returns records that show high-level workflow status like open, closed, failed, etc.

By status I mean the status that describeWorkflowExecution response has :
"WORKFLOW_EXECUTION_STATUS_UNSPECIFIED","WORKFLOW_EXECUTION_STATUS_RUNNING", "WORKFLOW_EXECUTION_STATUS_COMPLETED","WORKFLOW_EXECUTION_STATUS_FAILED", "WORKFLOW_EXECUTION_STATUS_CANCELED", "WORKFLOW_EXECUTION_STATUS_TERMINATED", "WORKFLOW_EXECUTION_STATUS_TIMED_OUT","UNRECOGNIZED", "WORKFLOW_EXECUTION_STATUS_CONTINUED_AS_NEW"
Is listWorkflowExecutions going to return different status? If yes, can you point me to the documentation that explains about these statuses. Also, is there a way to use workflow IDs in list API as part of the query field in the request?

Yes, the list workflow is going to return this.

Also, is there a way to use workflow IDs in list API as part of the query field in the request?

I believe you can concatenate multiple conditions, one per ID.

Thanks for the information.

I used WorkflowId IN (ā€˜ā€™, ā€˜ā€™) following Visibility | Temporal Documentation.

Java code:

client.getWorkflowServiceStubs().blockingStub()
                .listWorkflowExecutions(
                        ListWorkflowExecutionsRequest.newBuilder()
                                .setNamespace(client.getOptions().getNamespace())
                                .setQuery("WorkflowId IN ('<id1>', '<id2'>)")
                                .build());

The above code worked.

1 Like