From 40941b87488960da3f7aedf37fd7ab8d08e3ae51 Mon Sep 17 00:00:00 2001 From: Brad Clements Date: Wed, 11 Oct 2023 17:56:40 -0400 Subject: [PATCH 1/3] 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 --- ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py | 1 + 1 file changed, 1 insertion(+) 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..efb5b8f4 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,7 @@ def call_child_workflow(self, workflow: Workflow, *, def wf(ctx: task.OrchestrationContext, inp: TInput): daprWfContext = DaprWorkflowContext(ctx) return workflow(daprWfContext, inp) + wf.__name__ = workflow.__name__ # copy workflow name so durabletask.worker can find the orchestrator in its registry return self.__obj.call_sub_orchestrator(wf, input=input, instance_id=instance_id) def wait_for_external_event(self, name: str) -> task.Task: From 1b74f646acede69abba906fe20a3416a08a26b0f Mon Sep 17 00:00:00 2001 From: Bernd Verst Date: Tue, 31 Oct 2023 14:39:26 -0700 Subject: [PATCH 2/3] Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py Signed-off-by: Bernd Verst --- .../dapr/ext/workflow/dapr_workflow_context.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 efb5b8f4..0bc0e347 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,7 +61,8 @@ def call_child_workflow(self, workflow: Workflow, *, def wf(ctx: task.OrchestrationContext, inp: TInput): daprWfContext = DaprWorkflowContext(ctx) return workflow(daprWfContext, inp) - wf.__name__ = workflow.__name__ # copy workflow name so durabletask.worker can find the orchestrator in its registry + # 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: From ef39b1cac43040b50cb56fc1f6f7705fe7bea3ce Mon Sep 17 00:00:00 2001 From: Bernd Verst Date: Tue, 31 Oct 2023 14:41:21 -0700 Subject: [PATCH 3/3] Update ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py Signed-off-by: Bernd Verst --- .../dapr/ext/workflow/dapr_workflow_context.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 0bc0e347..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 @@ -62,7 +62,7 @@ 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__ + 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: