0
0
Azurecloud~10 mins

Durable Functions for workflows in Azure - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start a Durable Function orchestration.

Azure
client = df.DurableOrchestrationClient(context)
instance_id = await client.[1]("MyOrchestrator", input_data)
Drag options to blanks, or click blank then click option'
Astart_new
Binvoke
Crun
Dexecute
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'run' instead of 'start_new' which does not start orchestration.
Confusing 'invoke' or 'execute' as valid methods.
2fill in blank
medium

Complete the code to define an activity function in Durable Functions.

Azure
@df.activity_trigger
async def [1](name: str) -> str:
    return f"Hello, {name}!"
Drag options to blanks, or click blank then click option'
Amain
Borchestrator_function
Cgreeting_activity
Drun_activity
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'orchestrator_function' which is reserved for orchestrator functions.
Using generic names like 'main' that do not describe activity.
3fill in blank
hard

Fix the error in the orchestrator function to call an activity function.

Azure
def orchestrator_function(context: df.DurableOrchestrationContext):
    result = yield context.[1]("greeting_activity", "Azure")
    return result
Drag options to blanks, or click blank then click option'
Astart_activity
Bcall_activity_async
Ccall_sub_orchestrator
Dcall_activity
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'call_activity_async' which is not a valid method.
Using 'start_activity' which does not exist.
4fill in blank
hard

Fill both blanks to correctly wait for an orchestration to complete and get its status.

Azure
status = await client.[1](instance_id)
result = await client.[2](instance_id)
Drag options to blanks, or click blank then click option'
Await_for_completion
Bget_status
Cget_result
Dstart_new
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'start_new' instead of waiting or getting status.
Confusing 'get_result' with 'get_status'.
5fill in blank
hard

Fill all three blanks to correctly define an orchestrator function that calls two activities sequentially.

Azure
def [1](context: df.DurableOrchestrationContext):
    result1 = yield context.[2]("activity_one", None)
    result2 = yield context.[3]("activity_two", result1)
    return result2
Drag options to blanks, or click blank then click option'
Aorchestrator_function
Bcall_activity
Dmain_function
Attempts:
3 left
💡 Hint
Common Mistakes
Using different method names for activity calls.
Naming the orchestrator function incorrectly.