-
Notifications
You must be signed in to change notification settings - Fork 64
Sub-orchestrators now available #157
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
Conversation
ConnorMcMahon
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 for the most part, but let's look to see if we can get some tests for this.
|
Added a sample, and tests, and fixed errors. @ConnorMcMahon, when you get the chance, I'd appreciate another look :) |
ConnorMcMahon
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.
LGTM!
Addresses: #62
This PR enables sub-orchestrators and sub-orchestrators with retry options in Python Durable Functions 🥳 !
In implementing this, I had to review the structure of similar features, such as
call_activityandcall_activity_with_retryto see how those structured their implementation.What became very clear is that there are many opportunities for refactoring, because there is a lot of shared logic between a function like
call_activityandcall_sub_orchestrator. Also, there's a lot of shared logic between a function likefind_sub_orchestration_createdandfind_sub_orchestration_completed. To avoid deviating from the tried-and-tested approach, this PR only makes a first attempt at consolidating this shared logic: thefind_sub_orchestrator_created,find_sub_orchestration_completedandfind_sub_orchestration_failedare all abstracted into a core methodfind_sub_orchestratorwhich is able to handle all of their logic by simply including a specializingHistoryEventTypeas a new parameter.To show how this approach subsumes the logic of those three functions, I make their implementation be simply a call to
find_sub_orchestrationwith their appropriateHistoryEventTypeparameter. I believe this refactoring can be done for mostawaitableandyieldablefunctions in this SDK, and I hope we can do that refactor in a future PR.There are other opportunities for refactoring that I ignored, for time, but I think y'all will be able to spot them quickly.
I'm tracking the new refactoring task here: #167
One thing that is glaringly missing from this PR are tests for the sub-orchestrator. I can add them now, or add them in a future PR scheduled for the next release, especially considering that we are still in beta. Please let me know what you think, I don't mind either way.