-
Notifications
You must be signed in to change notification settings - Fork 130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
change call_child_workflow to pass correct wf name to durabletask worker #616
Conversation
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 <bkc@murkworks.com>
@@ -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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While hacky, this feels like the right fix given the current limitations of the durabletask-python library. Ideally we add a parameter to call_sub_orchestrator
that allows overriding the name so that callers don't need to be aware of the internal implementation details.
@DeepanshuA thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll merge this and you can consider a better solution in a future release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Comment line is too long. Please see Python style guide ;)
ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Bernd Verst <github@bernd.dev>
ext/dapr-ext-workflow/dapr/ext/workflow/dapr_workflow_context.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Bernd Verst <github@bernd.dev>
Description
durabletask.worker uses
orchestrator.__name__
herebut when dapr_workflow_context wraps the real workflow function in
wf
, the correct orchestrator name is lost.This bug results in the following exception:
when called as
This proposed fix is not pretty, but it works.
Issue reference
We strive to have all PR being opened based on an issue, where the problem or feature have been discussed prior to implementation.
Please reference the issue this PR will close: #615
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list:
There aren't any existing tests or even any examples that use call_child_workflow, I'm sorry I do not have time to write tests or documentation at this time.