Can you pass Python datetime objects between Azure durable functions?

Clay Casper 176 Reputation points
2022-08-04T16:06:03.3+00:00

I am defining a variable in a sub-orchestrator and try to pass it between different durable functions. It's resulting in a non-deterministic workflow. In the docs (https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-code-constraints?tabs=python#dates-and-times) it says that you can't use datetime.now() but I'm not using the now() method. Rather I'm just setting the datetime to a static date and time. The docs also say the list of constraints isn't comprehensive so maybe I'm missing something, but in general is it possible to pass datetime objects between durable functions?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,909 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,506 Reputation points
    2022-08-10T06:45:40.35+00:00

    @Clay Casper ,

    "I am defining a variable in a sub-orchestrator and try to pass it between different durable functions."

    Are you referring to activity functions when you mention "different durable functions" ?

    Please let me know. Also you will have to avoid using static variables in durable functions

    Avoid using static variables in orchestrator functions because their values can change over time, resulting in nondeterministic runtime behavior. Instead, use constants, or limit the use of static variables to activity functions.

    https://learn.microsoft.com/en-us/azure/azure-functions/durable/durable-functions-code-constraints?tabs=python#static-variables

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.