Skip to content

Commit

Permalink
change call_child_workflow to pass correct wf name to durabletask wor…
Browse files Browse the repository at this point in the history
…ker (#616)

* change call_child_workflow to pass correct wf name to durabletask worker

durabletask.worker uses orchestrator.__name__ at https://github.com/microsoft/durabletask-python/blob/c9990973a7cc18b2db1219d129961cede9eb3948/durabletask/worker.py#L387  

but when dapr_workflow_context wraps the real workflow function in `wf`, the correct orchestrator name is lost.

This bug results in an exception:

durabletask.task.TaskFailedError: Sub-orchestration task #1 failed: A 'wf' orchestrator was not registered.

This proposed fix is not pretty, but it works.

Signed-off-by: Brad Clements <[email protected]>

* Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py

Signed-off-by: Bernd Verst <[email protected]>

* Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py

Signed-off-by: Bernd Verst <[email protected]>

---------

Signed-off-by: Brad Clements <[email protected]>
Signed-off-by: Bernd Verst <[email protected]>
Co-authored-by: Bernd Verst <[email protected]>
  • Loading branch information
bkc and berndverst authored Oct 31, 2023
1 parent 7e3704d commit 00937c6
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def call_child_workflow(self, workflow: Workflow, *,
def wf(ctx: task.OrchestrationContext, inp: TInput):
daprWfContext = DaprWorkflowContext(ctx)
return workflow(daprWfContext, inp)
# copy workflow name so durabletask.worker can find the orchestrator in its registry
wf.__name__ = workflow.__name__
return self.__obj.call_sub_orchestrator(wf, input=input, instance_id=instance_id)

def wait_for_external_event(self, name: str) -> task.Task:
Expand Down

0 comments on commit 00937c6

Please sign in to comment.