[英]Amazon Simple Workflow - Given workflowID List all executions
Workflow when started again, with same workflowID, it gets a different runID. 再次启动工作流时,使用相同的workflowID,它会获得不同的runID。 Is there a way to retrieve such executions(containing different runID) of a given workflow ID? 有没有办法检索给定工作流ID的此类执行(包含不同的runID)?
I explored ListClosedWorkflowExecutionsRequest
API but it just lists all the workflow executions, not for a particular workflowID. 我探索了ListClosedWorkflowExecutionsRequest
API,但它只列出了所有工作流程执行,而不是特定的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
. 所以我要做的是,使用ListClosedWorkflowExecutionsRequest
列出所有失败的工作流ID。 For each workflowID, fetch all executions and if latest of them is successful, skip it else restart. 对于每个workflowID,获取所有执行,如果最新执行,则跳过它,否则重启。
I am little new to SWF so is there a better way to accomplish same? 我对SWF不是新手,所以有更好的方法来实现吗?
Thanks 谢谢
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 . 是的,可以通过workflowId进行过滤, 如果您拥有的是Amazon SWF中的workflowId,如何获取WorkflowExecution的状态中所述 。
The answer is on line [7] and [9] in the example, the executions()
method call. 答案是在示例中的[7]和[9], executions()
方法调用。 For your use case though, since all you want are closed executions, you'll just alter the method call to include closed=True
. 但是对于你的用例,因为你想要的只是关闭执行,你只需要改变方法调用以包括closed=True
。 So, in order to get all closed executions in the 24hours (the default): 因此,为了在24小时内完成所有已关闭的执行(默认值):
In [7]: domain.executions(closed=True)
And for closed executions filtered by workflow id: 对于按工作流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 . 如果您不使用boto.swf
而是替代库,请参阅API文档,了解传递给ListClosedWorkflowExecutions API的必要参数。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.