Question

Workflow when started again, with same workflowID, it gets a different runID. Is there a way to retrieve such executions(containing different runID) of a given workflow ID?

I explored ListClosedWorkflowExecutionsRequest API but it just lists all the workflow executions, not for a particular workflowID.

Problem I am trying to solve is: There were many workflows that failed for some reason. In restarting process, I didn't include correct time filter and few of them were restarted while few got skipped. So what I am trying to do is, list all failed workflow IDs using ListClosedWorkflowExecutionsRequest. For each workflowID, fetch all executions and if latest of them is successful, skip it else restart.

I am little new to SWF so is there a better way to accomplish same?

Thanks

Was it helpful?

Solution

Yes, it is possible to filter by workflowId as described in How do you get the state of a WorkflowExecution if all you have is a workflowId in Amazon SWF.

The answer is on line [7] and [9] in the example, the executions() method call. For your use case though, since all you want are closed executions, you'll just alter the method call to include closed=True. So, in order to get all closed executions in the 24hours (the default):

In [7]: domain.executions(closed=True)

And for closed executions filtered by workflow id:

In [9]: domain.executions(workflow_id='my_wf_id', closed=True)

If you're not using boto.swf but an alternative library instead, refer to the API docs for what are the necessary parameters to pass to the ListClosedWorkflowExecutions API.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top