From 00937c69cbe8020ca2a50a0a90e53981bceb599d Mon Sep 17 00:00:00 2001 From: Brad Clements Date: Tue, 31 Oct 2023 17:45:42 -0400 Subject: [PATCH] change call_child_workflow to pass correct wf name to durabletask worker (#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 * Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py Signed-off-by: Bernd Verst * Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py Signed-off-by: Bernd Verst --------- Signed-off-by: Brad Clements Signed-off-by: Bernd Verst Co-authored-by: Bernd Verst --- .../dapr/ext/workflow/dapr_workflow_context.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py b/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py index 291c3225..96cab225 100644 --- a/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py +++ b/ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py @@ -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: