-
Notifications
You must be signed in to change notification settings - Fork 34
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
Initial push for adding orchestration reuse ID #258
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Ryan Lettieri <[email protected]>
Signed-off-by: Ryan Lettieri <[email protected]>
Signed-off-by: Ryan Lettieri <[email protected]>
Signed-off-by: Ryan Lettieri <[email protected]>
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 think you may have already updating the protobuf submodule, but was there merge issues in that repo? Looks like all the entity work is gone.
@@ -40,5 +41,6 @@ public interface IOrchestrationSubmitter | |||
TaskName orchestratorName, | |||
object? input = null, | |||
StartOrchestrationOptions? options = null, | |||
HashSet<string>? orchestrationIdReusePolicy = null, |
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.
Please add this to StartOrchestrationOptions
instead of its own parameter. All non-essential parameters for affecting orchestration start should go there.
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.
Also, should this be an enum with the available behaviors as values in it?
@@ -40,5 +41,6 @@ public interface IOrchestrationSubmitter | |||
TaskName orchestratorName, | |||
object? input = null, | |||
StartOrchestrationOptions? options = null, | |||
HashSet<string>? orchestrationIdReusePolicy = null, |
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.
"ReusePolicy" isn't that clear to me. Was the name InstanceIdConflictBehavior
considered?
This will also address #183 |
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 suggest the following approach:
- Create a new enum in
Abstractions.csproj
to represent the possible states for this feature. This is the type the customer will interact with. - Add this as an optional value to
StartOrchestrationOptions
and(actually only worry about Start options in this PR, we can tackle sub-orchestration options later)SubOrchestrationOptions
- Add a configurable default value to
DurableTaskClientOptions
andDurableTaskWorkerOptions
. This default value will be used when a customer does not explicitly provide it on the options from point 2. - Update clients and workers to consume this as appropriate. The gRPC client/worker implementation would convert the public facing enum to the gRPC enum internally.
src/Abstractions/Abstractions.csproj
Outdated
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.0" /> | ||
<PackageReference Include="System.Text.Json" Version="6.0.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="../../src/Grpc/Grpc.csproj" /> |
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.
This project should not reference gRPC. It is meant to be implementation agnostic.
Signed-off-by: Ryan Lettieri <[email protected]>
src/Abstractions/TaskOptions.cs
Outdated
/// <param name="OrchestrationIdReusePolicy">The orchestration reuse policy. This allows for the reuse of an instance ID | ||
/// as well as the options for it.</param> | ||
public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null, | ||
Dictionary<List<OrchestrationOptions.OrchestrationRuntimeStatus>, OrchestrationOptions.InstanceIdReuseAction>? OrchestrationIdReusePolicy = null); |
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 see what you are trying to solve here: making it more granular on what the behavior is based on the state of the orchestration. Which I do think is worth considering.
I see the following problems with this approach:
- This information does not align with the protobuf spec
- It is a bit unwieldy for customers to need to specify this dictionary.
Instead, here is what I recommend:
- Lets first evaluate if this is needed? Or can we decide and document what the behavior of the 3 individual policies are based on the orchestration state? For example, we may consider applying conflict resolution for non-terminal orchestrations only.
- If not, then we can expand the protobuf and our enum to have more states that better clarify what happens. IE:
ErrorAlways
,ErrorIfRunning
eg.
The end result should be customers need to only provide a single enum to this options object.
Signed-off-by: Ryan Lettieri <[email protected]>
/// <summary> | ||
/// Enum describing the runtime status of the orchestration. | ||
/// </summary> | ||
public enum OrchestrationRuntimeStatus |
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 think we will need to have type-forwarding from this type in the client package.
/// <param name="OrchestrationIdReusePolicy">The orchestration reuse policy. This allows for the reuse of an instance ID | ||
/// if the instance ID referenced is in any of the states supplied in this parameter.</param> | ||
public record StartOrchestrationOptions(string? InstanceId = null, DateTimeOffset? StartAt = null, | ||
OrchestrationRuntimeStatus[]? OrchestrationIdReusePolicy = null); |
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.
Can we wrap this in a type: OrchestrationIdReuse
, so we can have helpers:
OrchestrationIdReuse.IfTerminal; // has all terminal statuses included.
OrchestrationIdReuse.Always; // has all statuses included.
OrchestrationIdReuse.IfStatus(params OrchestrationRuntimeStatus[] statuses);
OrchestrationIdReuse.IfStatus(IEnumerable<OrchestrationRuntimeStatus> statuses);
OrchestrationIdReuse.Never; // equal to default.
@@ -83,6 +83,7 @@ public override ValueTask DisposeAsync() | |||
Version = orchestratorName.Version, | |||
InstanceId = options?.InstanceId ?? Guid.NewGuid().ToString("N"), | |||
Input = this.DataConverter.Serialize(input), | |||
OrchestrationIdReusePolicy = { }, |
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.
You need to map this from options
correct?
@@ -17,11 +22,13 @@ The client is responsible for interacting with orchestrations from outside the w | |||
|
|||
<ItemGroup> | |||
<ProjectReference Include="../Core/Client.csproj" /> | |||
<ProjectReference Include="../../Grpc/Grpc.csproj" /> |
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.
this shouldn't be depending on gRPC
@@ -8,6 +8,11 @@ The client is responsible for interacting with orchestrations from outside the w | |||
<EnableStyleCop>true</EnableStyleCop> | |||
</PropertyGroup> | |||
|
|||
<ItemGroup> | |||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="6.0.0" /> |
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.
What are these packages needed for?
Related Issue: #255