How to get All the stage Name and status in an execution

I want to know the Name of all the stage and their status when i initiate a workflow. Is there any way to get this data from temporal.

Hello @AniketSinha

When you say stages, I guess you are referring to activities. Is that correct?

Assuming you are using the latest UI version.

From the UI you can get the list of activities and their status (along with Signals and Timers. ) if you select “Compact view”,

There is also a tab to list pending activities.

Programmatically, to get the activity names once they are initiated or completed (or failed/cancelled), you can either:

  • store activity names (and their status) in a workflow variable (Eg. list) and have a queryMethod that returns the value.

  • get the workflow history and filter events with eventType

    • ActivityTaskCompleted: indicates the activity has been completed (you might want to filter ActivityTaskFailed / Cancelled too)
    • ActivityTaskScheduled indicates the activity is either scheduled or started. (ActivityTaskStarted is not written in workflow history until the activity is completed/failed/cancelled
  • DescribeWorkflowExecution API , returns the list of pending activities as part of the response (eg. using tctl tctl workflow describe --workflow_id <workflowId>

Let me know if it helps.

Hello @antonio.perez

Thanks for clearing this out. Is there any way I can get the Activity names from temporal without hardcoding it to workflow Variables?

If you don’t want do that or go through the event history as mentioned you could use search attribute to store completed activity executions (upsert search attribute value in your workflow code when activity completes). Temporal server version 1.20 added KeywordList search attribute type that might be useful (see “Advanced visibility” section in release note).