4
votes

Is an ActivityTrigger Durable Function still restricted to max timeout duration of 10 mins via consumption plan below:

https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#timeout

I came across the sample below, which seems to run over 10mins.

[FunctionName("A_SimulateLongRunningTask")]
public static async Task<object> TaskExecutor([ActivityTrigger] string taskInput, TraceWriter log)
{
   dynamic longRunningTask = JsonConvert.DeserializeObject(taskInput);

   //Simulate a long running task, based on the provided duration
   //taskDurationInSeconds is 700 seconds, which is more than max of 10mins via consumption plan
   await Task.Delay(TimeSpan.FromSeconds((int)longRunningTask.taskDurationInSeconds));
   return true;
}

https://toonvanhoutte.wordpress.com/2018/08/19/perform-long-running-logic-apps-tasks-with-durable-functions/

https://docs.microsoft.com/en-us/azure/azure-functions/functions-host-json#functiontimeout https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale#timeout

1
have you actually tried to run that activity function and let it sleep (Task.Delay()) longer then the Function timeout? I don't think this should work.silent
Glad you linked all of the relevant documentation, doesn't seem to be a clear answer I could find on this. @silent , I don't believe the function timeout applies to the durable functions. There are patterns for the OrchestrationTrigger that can run in a while loop (Example: docs.microsoft.com/en-us/azure/azure-functions/durable/…), but I am not sure about the lifetime for an ActivityTrigger. I assume it is also unconstrained, but would like clarification.Matt Sanders

1 Answers

-2
votes

It is a method of breaking up a long running task into multiple shorter running tasks and then linking them together so that each one call the next in the workflow once it completes. This essentially can free you up from the limited time constraints imposed by the Azure Functions Runtime that limits the maximum amount of time a Function can execute before it would be automatically killed off.

All these patterns must execute tasks that require custom code and they need to run in an asynchronous way, potentially for a long time, Azure Durable Functions is definitely the way to go. This blog post describes how we can implement a generic way of handling long-running tasks via Durable Functions, via the webhook action pattern.