【问题标题】:Setting MaxOrchestrationActions in an Azure Durable Function在 Azure 持久函数中设置 MaxOrchestrationActions
【发布时间】:2020-10-27 20:04:42
【问题描述】:

我们正在使用一个 Durable Orchestrator 函数,该函数需要对 Activity 函数进行数百万次调用。我们在 100,000 次调用后看到以下异常:

已达到编排操作的最大数量 100,000。这 值可以在 host.json 文件中配置为 MaxOrchestrationActions。

但是,我找不到如何设置此值。

host.json schema here 中没有指定。

我已经为Azure Function Durable Extension 提取了开发分支的负责人并跟踪了源代码。看来这个可以设置为 DurableTaskOptions.MaxOrchestrationActions,但必须在传入 DurableOrchestrationContext 类之前设置。

我们猜测host.json中的属性可能是

{
   "extensions": {
      ... other settings omitted for brevity ...
      "durableTask": {
         "MaxOrchestrationActions": xxxx
      }
   }
}

但是没有运气。

有人对如何设置 MaxOrchestrationActions 有指导吗?

更新 我的问题是我使用的是旧版本的 Microsoft.Azure.WebJobs.Extensions.DurableTask 框架。一旦我更新到 2.1.1,它就按预期工作了。

我已向 Microsoft Doc 团队报告缺少 maxOrchestrationActions 文档,他们正在对文档进行更新。

【问题讨论】:

    标签: azure azure-durable-functions


    【解决方案1】:

    你是对的,默认值是 100k,你应该可以使用 host.json 进行更改。

    我注意到两件事:您没有提供版本号并且您没有使用驼峰式案例:

    {
       "version": "2.0",
       "extensions": {
          "durableTask": {
             "maxOrchestrationActions": xxxx
          }
       }
    }
    

    更多信息:

    https://docs.microsoft.com/en-us/dotnet/api/microsoft.azure.webjobs.extensions.durabletask.durabletaskoptions?view=azure-dotnet

    https://github.com/Azure/azure-functions-durable-extension/pull/982/commits/fd63d9436ef7fe4748c3a6aff95f9ac8596ab587

    【讨论】:

    • 感谢您的回复。为简洁起见,我省略了所有其他 host.json 属性,但现在在我的问题中指出了这一点。我还尝试了 MaxOrchestrationActions(如错误消息中所述)和 maxOrchestrationActions,但在这两种情况下都没有运气。 DurableTaskOptions 类的链接确实显示了我们想要更改的属性,但是在初始化 DurableOrchestrationContext 之后设置它并没有好处。在 DurableOrchestrationContext 构造函数中,该属性被复制到私有只读 int 中。
    • 您的代码 sn-p 是正确的。我的问题是我没有使用最新版本的 Microsoft.Azure.WebJobs.Extensions.DurableTask 框架。
    【解决方案2】:

    对我来说,推荐的答案不起作用。这可能是因为我有依赖注入。所以我设法通过注入 DurableTaskOptions 来实现这一点:

    .AddSingleton<IOptions<DurableTaskOptions>>(new OptionsWrapper<DurableTaskOptions>(
                        new DurableTaskOptions
                            {MaxOrchestrationActions = 1500000}))
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-01-31
      • 1970-01-01
      • 2021-09-24
      • 1970-01-01
      • 2021-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多