79447600

Date: 2025-02-18 08:48:50
Score: 1
Natty:
Report link
  1. Is there a manual way to stop the execution of the orchestrations other than stopping the function app?

You can stop the running Orchestration by suspending the Orchestration, refer MSDOC

suspend_reason = "Found a bug"
client.suspend(instance_id, suspend_reason)

Code:

myApp = df.DFApp(http_auth_level=func.AuthLevel.ANONYMOUS)
@myApp.route(route="orchestrators/{functionName}")
@myApp.durable_client_input(client_name="client")
async def http_start(req: func.HttpRequest, client):
    function_name = req.route_params.get('functionName')
    instance_id = await client.start_new(function_name)
    response = client.create_check_status_response(req, instance_id)
    await client.suspend(instance_id, "found a bug")
    logging.info("Orchestration suspended")
    return response

Console response:

Functions:

        http_start:  http://localhost:7071/api/orchestrators/{functionName}

        hello: activityTrigger

        hello_orchestrator: orchestrationTrigger

For detailed output, run func with --verbose flag.
[2025-02-18T07:55:19.194Z] Host lock lease acquired by instance ID '000000000000000000000000F72731CC'.
[2025-02-18T07:55:50.392Z] Executing 'Functions.http_start' (Reason='This function was programmatically called via the host APIs.', Id=05a6a228-0dfb-4dcd-8c91-29da78ed0a1e)

[2025-02-18T07:55:50.760Z] Orchestration suspended

[2025-02-18T07:55:50.960Z] Executing 'Functions.hello_orchestrator' (Reason='(null)', Id=07f199d9-fd10-422b-a66e-e84677011a30)
[2025-02-18T07:55:50.966Z] Executed 'Functions.http_start' (Succeeded, Id=05a6a228-0dfb-4dcd-8c91-29da78ed0a1e, Duration=607ms)
[2025-02-18T07:55:51.054Z] Executed 'Functions.hello_orchestrator' (Succeeded, Id=07f199d9-fd10-422b-a66e-e84677011a30, Duration=110ms)
[2025-02-18T07:55:51.126Z] Executing 'Functions.hello' (Reason='(null)', Id=31e72fb9-ce64-4983-a931-8ceb9b1be8c1)
[2025-02-18T07:55:51.133Z] Executed 'Functions.hello' (Succeeded, Id=31e72fb9-ce64-4983-a931-8ceb9b1be8c1, Duration=9ms)
[2025-02-18T07:55:51.154Z] Executing 'Functions.hello_orchestrator' (Reason='(null)', Id=690cd49d-2765-41e0-bb43-e8b85c51f18a)
[2025-02-18T07:55:51.167Z] Executed 'Functions.hello_orchestrator' (Succeeded, Id=690cd49d-2765-41e0-bb43-e8b85c51f18a, Duration=15ms)
[2025-02-18T07:55:51.201Z] Executing 'Functions.hello_orchestrator' (Reason='(null)', Id=2d51e367-b295-45b4-ace4-a24dd1c5615e)
[2025-02-18T07:55:51.210Z] Executed 'Functions.hello_orchestrator' (Succeeded, Id=2d51e367-b295-45b4-ace4-a24dd1c5615e, Duration=9ms)

Orchestration Status can be seen as below:

enter image description here

You can also terminate the Orchestration by running the terminatePostURI of the function:

enter image description here

enter image description here

[2025-02-18T08:03:25.173Z] 523f442ed0574d3dab2f2d0226a27ce7: Function 'hello_orchestrator (Orchestrator)' was terminated. 
Reason: found a bug. State: Terminated. RuntimeStatus: Terminated. HubName: TestHubName. AppName: . SlotName: . ExtensionVersion: 2.13.2. SequenceNumber: 12.
[2025-02-18T08:03:25.233Z] Executing 'Functions.hello_orchestrator' (Reason='(null)', Id=95c9b9a7-5728-4ad5-ab35-439a6d377714)
[2025-02-18T08:03:25.242Z] Executed 'Functions.hello_orchestrator' (Succeeded, Id=95c9b9a7-5728-4ad5-ab35-439a6d377714, Duration=10ms)
  1. How do I set the number of retries to 0?

Set max_number_of_attempts=1, refer MSDOC.

first_retry_interval_in_milliseconds  =  5000
max_number_of_attempts  =  1
retry_options = df.RetryOptions(first_retry_interval_in_milliseconds, max_number_of_attempts)

Code:

# Orchestrator
@myApp.orchestration_trigger(context_name="context")
def hello_orchestrator(context: df.DurableOrchestrationContext):
    first_retry_interval_in_milliseconds = 5000
    max_number_of_attempts = 1

    retry_options = df.RetryOptions(first_retry_interval_in_milliseconds, max_number_of_attempts)
    result = yield context.call_activity_with_retry('hello', retry_options)
    result1 = yield context.call_activity("hello", "Seattle")
    result2 = yield context.call_activity("hello", "Tokyo")
    result3 = yield context.call_activity("hello", "London")

    return [ result1, result2, result3]
Reasons:
  • Blacklisted phrase (1): How do I
  • Long answer (-1):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Starts with a question (0.5): Is there a
  • High reputation (-1):
Posted by: Pravallika KV