-
Notifications
You must be signed in to change notification settings - Fork 298
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
Allow TaskHubClient's CreateOrchestrationInstanceAsync to schedule orchestrators #1107
Allow TaskHubClient's CreateOrchestrationInstanceAsync to schedule orchestrators #1107
Conversation
If another method already exists that implements the scheduling behavior, why is this PR needed? In other words, why can’t we have the consuming SDK use the existing method? That wasn’t clear in this PR description and I’m hesitant to agree to adding a redundant method overload. |
Yeah I didn't make this clear. I see two main reasons to make this change, but please do push back if needed: First - The overloads for For evidence: if we do a CTRL+F for "Task CreateScheduledOrchestrationInstanceAsync" in (A.1) durabletask/src/DurableTask.Core/TaskHubClient.cs Lines 83 to 86 in 7a778c3
(A.2) durabletask/src/DurableTask.Core/TaskHubClient.cs Lines 108 to 113 in 7a778c3
(A.3)
Meanwhile, a CTRL+F for durabletask/src/DurableTask.Core/TaskHubClient.cs Lines 344 to 351 in 7a778c3
So, it seems to me that there's a parameter-parity gap between the two APIs that favors Second -
So it seems to me that Hope that makes sense, sorry for the wall of text. In short - I think the two APIs already have overlapping responsibilities, and I'm just trying to give the API with more parameters another overload to have it fully subsume the other one. |
Ultimately though, I don't feel strongly. Just think this makes sense in the long run. |
@davidmrdavid got it, the two reasons you called out have eased my concerns. I'm good with these changes. Thanks for explaining! |
/// <summary> | ||
/// A test implementation of <see cref="LocalOrchestrationService"/> that captures messages for later inspection. | ||
/// </summary> | ||
public class TestLocalOrchestrationService : LocalOrchestrationService |
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.
Since this file is the only place where this new class is being used, can it instead be an inner class of TaskHubClientTests
instead of being a top-level class?
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.
Sorry, I completely missed this and I already just merged the PR. I'll add this to my ToDo list for a future iteration
Related: Azure/azure-functions-durable-extension#2805
In the PR above, we learned if a user wants to schedule an orchestrator to start a particular time, they need to use the
CreateScheduledOrchestrationInstanceAsync
instead of using the more commonly usedCreateOrchestrationInstanceAsync
API.Allowing
CreateOrchestrationInstanceAsync
to also schedule orchestrators by accepting a newfireAt
would simplify things downstream (in durabletask-dotnet, it would simplify the PR linked above^) so this PR adds that "missing" parameter. This does create some repetition (there are now two APIs that allow users to schedule orchestrators) but I think it makes the orchestrator-scheduling feature more discoverable while also helping simplify downstream code.This PR also include 2 additional minor contributions: