How can I structure a Azure Durable Function project with the Python V1 programming model?

Cedric Altermatt 20 Reputation points
2023-08-29T12:05:33.47+00:00

Hi,

I have an Azure Durable Function project that uses the Python V1 programming model and is currently structured like this:

api
|--activity_func_1
   |--__init__.py
   |--functions.json
|--activity_func_2
   ...
|--activity_func_3
   ...

... more activity functions

|--orchestrator
   |--__init__.py
   |--functions.json
|--starter
   |--__init__.py
   |--function.json
|--host.json

In my orchestrator/__init__.py I am calling my activity functions like this:

def orchestrator_function(context: df.DurableOrchestrationContext):
    res1 = context.call_activity('activity_func_1')
    res2 = context.call_activity('activity_func_2')

    ...

I have deployed this project and everything works fine but I would like to put the activity functions in their own directory, so I can keep my project structure tidy and organised:

api
|--activity_functions
   |--activity_func_1
      |--__init__.py
      |--functions.json
   |--activity_func_2
      ...
   |--activity_func_3
      ...

   ... more activity functions

|--orchestrator
   |--__init__.py
   |--functions.json
|--starter
   |--__init__.py
   |--function.json
|--host.json

Is that possible and if so, how would I call such an activity function from my orchestrator function?

Thank you a lot for the feedback.

Cheers

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

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.