简体   繁体   English

Amazon SWF并行子工作流程执行中止了父工作流程

[英]Amazon SWF Parallel Child Workflow Executions Halt Parent Workflow

I am attempting to start two parallel executions of a child workflow with differing starting parameters. 我正在尝试使用不同的启动参数启动子工作流程的两个并行执行。 However, I am noticing that only one of those child workflow executions is run. 但是,我注意到这些子工作流程执行中只有一个运行。 The parent workflow execution halts due to tasks not being scheduled which causes to not have any further activity in the execution history until it times out. 父工作流程的执行由于未计划的任务而暂停,这导致执行历史记录中的任何活动直到超时都没有。 No exceptions or errors are thrown, it just stops doing anything at all. 没有抛出异常或错误,它只是停止做任何事情。 Interestingly, it is always the second child workflow execution that completes. 有趣的是,总是第二个子工作流程执行完成。

If the parent runs only one execution of the child workflow, the child completes successfully, and the parent workflow continues to completion. 如果父级仅运行子级工作流程的一次执行,则子级将成功完成,并且父级工作流程将继续完成。 My suspicion is that it has something to do with running multiple copies of the child workflow simultaneously and that they interfere with each other since they poll the same tasklist; 我怀疑这与同时运行子工作流程的多个副本有关,并且由于它们轮询相同的任务列表而相互干扰。 I just don't know how I am supposed to approach the problem. 我只是不知道我应该如何解决这个问题。

Code: 码:

ProcessRunnerClient childWorkflowClient = factory.getClient();
List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
switch(condition){
case 1:
    childWorkflowsDone.add(childWorkflowClient.method(case1Params));
// Works fine
    break;
case 2:
    childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// Works fine
    break;
case 3:
    childWorkflowsDone.add(childWorkflowClient.method(case1Params));
    childWorkflowsDone.add(childWorkflowClient.method(case2Params));
// The execution of the child workflow with case2Params completes,
// and parent execution suspends
    break;
default:
    throw new WorkflowException("Condition " + condition + " not supported");
}

Make sure that each child workflow is started using its own instance of the generated client. 确保每个子工作流程都使用其自己的生成客户端实例启动。 So change your example to: 因此,将您的示例更改为:

List<Promise<T>> childWorkflowsDone = new ArrayList<Promise<T>>;
ProcessRunnerClient childWorkflowClient1 = factory.getClient()
childWorkflowsDone1.add(childWorkflowClient.method(params1));
ProcessRunnerClient childWorkflowClient2 = factory.getClient()
childWorkflowsDone.add(childWorkflowClient2.method(params2));

It is done to support communication to the child workflow after it is started. 启动它是为了支持与子工作流程之间的通信。 For example the same client can be used to send signal or retrieve runId . 例如,同一客户端可用于发送信号或检索runId

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM