-
Notifications
You must be signed in to change notification settings - Fork 138
Added async workflow client implementation, leveraging new durabletask.aio.client implementation #861
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
base: main
Are you sure you want to change the base?
Conversation
…k.aio.client implementation Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
d32c9aa to
d17b262
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #861 +/- ##
==========================================
+ Coverage 86.63% 87.49% +0.86%
==========================================
Files 84 98 +14
Lines 4473 6484 +2011
==========================================
+ Hits 3875 5673 +1798
- Misses 598 811 +213 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@passuied I think this other PR covers this same thing, and is a bit more complete because it also have async context, but it's WIP as it has lots of lint changes that are now applied to |
|
@acroca actually this is a bit different, as this tackles the client initiating actions against a workflow(schedule workflow, signal events), instead of the internals of the workflow that my PR tackles. He did the PR in durabletask that complements this dapr/durabletask-python#17. The PRs his/mine are complementary and not overlapping |
acroca
left a comment
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.
Looks good, but I'd follow the same pattern as the DaprClient and not have a suffix Async for the async version.
ext/dapr-ext-workflow/dapr/ext/workflow/aio/dapr_workflow_client.py
Outdated
Show resolved
Hide resolved
Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
|
@passuied Can you add an example to |
- Created an async version of `WorkflowRuntime` that takes event_loop as a param. Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
Signed-off-by: Albert Callarisa <albert@diagrid.io>
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.
LGTM, but tests are failing, and copyright headers need to be fixed :)
ext/dapr-ext-workflow/dapr/ext/workflow/aio/workflow_runtime.py
Outdated
Show resolved
Hide resolved
- Updated simple-aio to show examples of async and sync activities Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
… works regardless of how we register it... Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
|
|
||
| @wraps(fn) | ||
| def target_fn(): | ||
| return fn |
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.
- Does this mean that if the
main_event_loopwas not provided in the constructor, we'll silently treat all activities as synchronous? If this is the case, should we makemain_event_looprequired? Otherwise, it seems to be defeating the purpose. Or am I missing something? - Isn't it supposed to call
fn()instead of returning the function itself?
| reuse_id_policy=reuse_id_policy, | ||
| ) | ||
| return await self.__obj.schedule_new_orchestration( | ||
| workflow.__name__, |
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.
Minor - consider storing the workflow.__dict__['_dapr_alternate_name'] / workflow.__name__ in a variable and avoiding code duplication around calling self.__obj.schedule_new_orchestration
| ] | ||
|
|
||
|
|
||
| class WorkflowRuntime(WorkflowRuntimeSync): |
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'm not sure if wrapping the sync runtime is the best course of action here. Instead, it should be natively supported by durabletask it looks like there's been a lot of work, including async support done there. Are you sure it's not already a resolved problem?
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.
@akotsarelation I agree that when I look at @filintod's PR, I'm inclined to wait for his work to be complete so we can replace the whole WorkflowRuntime with his full async implementation...
It wasn't so apparent until I worked on the example @acroca and I had to override WorkflowRuntime (but not in an ideal way as I still need the work from that PR)... While the current solution works it does mix sync and async and comes with performance downsides... If this PR is coming soon, I'm inclined to not publish this one and instead wait for the full blown solution....
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 guess the issue is that you were changing not only the client side (dapr_workflow_client) but also the workflowruntime, that yeah you would need something like what I am doing. Was that needed here? as your durabletask PR only dealt with the client side (schedule workflow, etc) and why I said this PR and the durabletask were complementary but not if mixing workflow runtime too.
Description
Added async workflow client implementation, leveraging new durabletask.aio.client implementation
Issue reference
#834
Checklist
Please make sure you've completed the relevant tasks for this PR, out of the following list: