Setting MaxOrchestrationActions in an Azure Durable Function

折月煮酒 提交于 2020-12-15 06:21:13

问题


We're using a Durable Orchestrator Function that needs to make several million calls to Activity functions. We're seeing the following exception after 100,000 invocations:

Maximum amount of orchestration actions 100,000 has been reached. This value can be configured in host.json file as MaxOrchestrationActions.

However, I cannot find HOW to set this value.

In the host.json schema here, it's not specified.

I've pulled the head of the dev branch for Azure Function Durable Extension and traced through the source code. It appears that this can be set as DurableTaskOptions.MaxOrchestrationActions, but it must be set before it's passed into the DurableOrchestrationContext class.

We've taken a guess that the property in host.json might be

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

But had no luck.

Does anyone have guidance on how to set MaxOrchestrationActions?

Update My problem was that I was using an older version of the Microsoft.Azure.WebJobs.Extensions.DurableTask framework. Once I updated to 2.1.1, it worked as expected.

I have reported the lack of documentation of maxOrchestrationActions to the Microsoft Doc team, and they're making an update to the documentation.


回答1:


You're right, the default value is 100k and you should be able to change using host.json.

Two things that I've noticed: you're not providing version number and you're not using camel case:

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

More Info:

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




回答2:


For me, the recommended answer didn't work. This could be because I have dependency injection. So I manage to achieve this by injecting DurableTaskOptions like this:

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


来源:https://stackoverflow.com/questions/62777387/setting-maxorchestrationactions-in-an-azure-durable-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!