Share via

Implementing Singleton Patterns in Durable Python Functions (Azure Functions v2)

RajuReddy-3295 40 Reputation points
2025-04-14T17:13:16.0166667+00:00

I'm interested in incorporating Singleton functionality within a Python-based Azure. Durable Function-specifically, to ensure that only a single instance of a particular orchestration or activity function is running at a time. Based on my research, the available documentation only outlines how to implement this pattern in Azure Functions v1, and it's unclear whether the same approach or an updated one is applicable to v2.

Could you please clarify whether Singleton behavior is officially supported in Azure Functions v2 for Python Durable Functions?

Any direction or documentation you can point me to would be greatly appreciated.

Azure Functions
Azure Functions

An Azure service that provides an event-driven serverless compute platform.


Answer accepted by question author

  1. Ranashekar Guda 2,905 Reputation points Moderator
    2025-04-14T19:02:23.85+00:00

    Hello @Raju Reddy,

    The documentation currently does not provide specific guidance on implementing Singletons for Durable Functions in Azure Functions v2 using Python. The concept of singletons in Durable Functions is applicable, and you can create a singleton orchestrator by assigning a specific instance ID to the orchestrator when creating it. This ensures that only one instance of the orchestrator runs at a time.

    For Python, you can use the Durable Functions 2.0 features, which include entity functions that can help manage stateful workflows. While the specific singleton implementation details for Python in v2 may not be explicitly documented, you can refer to the general principles of Durable Functions and adapt them to your needs.

    For further clarification, please refer to the following documentations:

    Singleton orchestrators in Durable Functions (Azure Functions)

    What are Durable Functions?

    Hope this helps. Do let us know if you any further queries.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful

Your answer

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