1

I am statrting new with Azure Durable functions, and I followed the tutorials and was able to run it without any error. As I see, my requirement will be to take output from one of the activity function and use as an input to other activity function, also the other activity function shouldnt start, unless the previous activity function has been completed. How can I do this?

Here is the code which runs: I would like "Hello" activity function return value which is src_client should be used as an input to activity function "Goodbye"

import logging
import json

import azure.functions as func
import azure.durable_functions as df


def orchestrator_function(context: df.DurableOrchestrationContext):
    result1 = yield context.call_activity('Hello', "bestday-demo")
    result2 = yield context.call_activity('Goodbye', "Seattle")
    result3 = yield context.call_activity('Hello', "London")
    return [result1, result2, result3]

main = df.Orchestrator.create(orchestrator_function) 

and this is my activity function "Hello"

import logging
from myownsdk import myClient


def main(projectname: str) -> str:
    SRC_PROJECT_DAY = projectname
    src_client = myClient(
        api_key= "Myapikey",
        client_name= "Proj-DEMO_CLIENT",
        project = SRC_PROJECT_DAY,
        debug=False
        )
    return f"{src_client}"

and this is my activity function "Goodbye". This returns "Goodbye Seattle", but I would like to pass my src_client from Hello activity function and use that to get some more results.

import logging
from myownsdk import myClient


def main(name: str) -> str:    
    return f"GoodBye {name}!"

Also how can i make sure, Goodbye runs only when Hello has been exceuted and completed. Thanks for help.

1 Answer 1

3

This is because you are calling goodbye function and the string Seattle in result2 and there is no way the orchestration is happening.

enter image description here

I observe that your orchestrator function isn't same when compared to original document So please make sure that you are calling it in a right way , As per the below code try to make changes in your code.

 import azure.functions as func
    import azure.durable_functions as df
      
   def orchestrator_function(context: df.DurableOrchestrationContext):
        result1 = yield context.call_activity('Hello', "bestday-demo")
        result2 = yield context.call_activity('Goodbye', result1)
        result3 = yield context.call_activity('Hello', result2)
        return result3
    
    
    main = df.Orchestrator.create(orchestrator_function)

Also, try to make changes in your Good Bye Activity Function.

import logging
from myownsdk import myClient


def main(name: str) -> str:    
    return f"GoodBye seattle {name}!"
Sign up to request clarification or add additional context in comments.

11 Comments

yes I figured that out and thank you for pointing this. one more question here: DO you know what is the time out limit for orchestrator function. suppose if I have a transformation which is happening between 3 different activity function and it takes more than 30 mins for transformation to complete, will my Orchestrator function time out? or is there any configuration I can do to let my orchestrator function stay alive until all transformation completes
Could you please help me with your Function App Service Plan
Where do i see my plan? lets say I have the most basic consumption one
> Where do i see my plan? You can view your plan type in your function app overview page and you need to select your plan type while creating function app as per the below image Function App Resource Plan Type
> orchestrator creating 250 activity calls, with functionTimeout set > as "01:00:00" As per the above statement from the Orchestrator timeout document which I sent earlier there is no need to define time out property for each activity function.
|

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.