简体   繁体   English

持久功能SubOrchestrator不返回

[英]Durable Function SubOrchestrator does not return

I have a durable function that defers to sub orchestrators, something like this: 我有一个持久的功能,可以顺应子协调程序,如下所示:

[FunctionName("Trigger")]
public static async Task OrchestrationFunctionFromHttpAsync(
    [OrchestrationTrigger]DurableOrchestrationContext context,
    ILogger log)
{
    var firstResult = await context.CallSubOrchestratorAsync<int>("FirstFunction", null);
    var secondResult = await context.CallSubOrchestratorAsync<int>("SecondFunction", null);
}

The first sub-orchestrator completes successfully, but the execution doesn't return to the orchestration function, so the second sub-orchestrator never gets called. 第一个子编排器成功完成,但是执行不返回到编排函数,因此永远不会调用第二个子编排器。 How would I even investigate why this is happening? 我什至将如何调查为什么发生这种情况?

This seems to be a bug in the durable functions framework. 这似乎是持久性功能框架中的错误。 I faced the same issue with a Javascript orchestrator that would exit as soon as the subOrchestration finished and without executing the code after the subOrchestration. 我遇到了一个Javascript Orchestrator相同的问题,该问题会在subOrchestration完成后立即退出,并且在subOrchestration之后不执行代码。 The issue seems to stem from a bug where the durable functions framework cannot retrieve the subOrchestration's output from the saved state if the subOrchestration did not have a defined instanceId. 问题似乎源于一个错误,即如果subOrchestration没有定义的instanceId,则持久函数框架无法从已保存状态检索subOrchestration的输出。 So by specifying a instanceId the code will execute fine. 因此,通过指定instanceId,代码将可以正常执行。

My orchestrator code that was failing looked like this: 我失败的协调器代码如下所示:

var reboot_result = yield context.df.callSubOrchestrator('reboot_orchestrator',reboot_input);
context.log('this is the next line after subOrch call which will not get called');

The context.log would never get called. context.log将永远不会被调用。 So I manually specify an instanceId on the callSubOrchestrator and this fixed the issue :) 因此,我在callSubOrchestrator上手动指定了一个instanceId,从而解决了问题:)

const child_id = context.df.instanceId + ":0"; //create instanceId
var reboot_result = yield context.df.callSubOrchestrator('reboot_orchestrator',reboot_input,child_id);
context.log('this is the next line after subOrch call and now it gets called properly');

Here's the link to the Github bug report: https://github.com/Azure/azure-functions-durable-js/issues/54 这是Github错误报告的链接: https : //github.com/Azure/azure-functions-durable-js/issues/54

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

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