Skip to content
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

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion eng/proto
2 changes: 2 additions & 0 deletions src/Abstractions/Internal/IOrchestrationSubmitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public interface IOrchestrationSubmitter
/// The optional input to pass to the scheduled orchestration instance. This must be a serializable value.
/// </param>
/// <param name="options">The options to start the new orchestration with.</param>
/// <param name="orchestrationIdReusePolicy">The policy for reusing an orchestration ID.</param>
/// <param name="cancellation">
/// The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the
/// orchestration once enqueued.
Expand All @@ -40,5 +41,6 @@ Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
Copy link
Member

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.

Copy link
Member

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?

Copy link
Member

@jviau jviau Jan 5, 2024

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?

CancellationToken cancellation = default);
}
21 changes: 15 additions & 6 deletions src/Client/Core/DurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,25 @@
public virtual DurableEntityClient Entities =>
throw new NotSupportedException($"{this.GetType()} does not support durable entities.");

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 54 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 59 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 59 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, object? input, CancellationToken cancellation)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, input, null, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, CancellationToken)"/>
/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 64 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 64 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, cancellation);
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, options, null, cancellation);

/// <inheritdoc cref="ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)"/>

Check warning on line 69 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

Invalid type for parameter HashSet in XML comment cref attribute: 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)'

Check warning on line 69 in src/Client/Core/DurableTaskClient.cs

View workflow job for this annotation

GitHub Actions / build

XML comment has cref attribute 'ScheduleNewOrchestrationInstanceAsync(TaskName, object, StartOrchestrationOptions, HashSet, CancellationToken)' that could not be resolved
public virtual Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName, StartOrchestrationOptions options, HashSet<string> orchestrationIdReusePolicy, CancellationToken cancellation = default)
=> this.ScheduleNewOrchestrationInstanceAsync(orchestratorName, null, null, orchestrationIdReusePolicy, cancellation);

/// <summary>
/// Schedules a new orchestration instance for execution.
Expand Down Expand Up @@ -96,6 +101,9 @@
/// The optional input to pass to the scheduled orchestration instance. This must be a serializable value.
/// </param>
/// <param name="options">The options to start the new orchestration with.</param>
/// <param name="orchestrationIdReusePolicy">
/// The orchestration reuse policy. This allows for the reuse of an instance ID as well as the options for it.
/// </param>
/// <param name="cancellation">
/// The cancellation token. This only cancels enqueueing the new orchestration to the backend. Does not cancel the
/// orchestration once enqueued.
Expand All @@ -110,6 +118,7 @@
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);

/// <inheritdoc cref="RaiseEventAsync(string, string, object, CancellationToken)"/>
Expand Down
6 changes: 4 additions & 2 deletions src/Client/Core/Entities/DurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ protected DurableEntityClient(string name)
/// <param name="operationName">The name of the operation.</param>
/// <param name="input">The input for the operation.</param>
/// <param name="options">The options to signal the entity with.</param>
/// <param name="orchestrationIdReusePolicy">The policy for reusing an orchestration ID.</param>
/// <param name="cancellation">The cancellation token to cancel enqueuing of the operation.</param>
/// <returns>A task that completes when the message has been reliably enqueued.</returns>
/// <remarks>This does not wait for the operation to be processed by the receiving entity.</remarks>
Expand All @@ -39,6 +40,7 @@ public abstract Task SignalEntityAsync(
string operationName,
object? input = null,
SignalEntityOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default);

/// <summary>
Expand All @@ -55,7 +57,7 @@ public virtual Task SignalEntityAsync(
string operationName,
SignalEntityOptions options,
CancellationToken cancellation = default)
=> this.SignalEntityAsync(id, operationName, null, options, cancellation);
=> this.SignalEntityAsync(id, operationName, null, options, null, cancellation);

/// <summary>
/// Signals an entity to perform an operation.
Expand All @@ -69,7 +71,7 @@ public virtual Task SignalEntityAsync(
EntityInstanceId id,
string operationName,
CancellationToken cancellation)
=> this.SignalEntityAsync(id, operationName, null, null, cancellation);
=> this.SignalEntityAsync(id, operationName, null, null, null, cancellation);

/// <summary>
/// Tries to get the entity with ID of <paramref name="id"/>. Includes entity state by default.
Expand Down
1 change: 1 addition & 0 deletions src/Client/Grpc/GrpcDurableEntityClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public override async Task SignalEntityAsync(
string operationName,
object? input = null,
SignalEntityOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
Check.NotNullOrEmpty(id.Name);
Expand Down
2 changes: 2 additions & 0 deletions src/Client/Grpc/GrpcDurableTaskClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
Check.NotEntity(this.options.EnableEntitySupport, options?.InstanceId);
Expand All @@ -83,6 +84,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
Version = orchestratorName.Version,
InstanceId = options?.InstanceId ?? Guid.NewGuid().ToString("N"),
Input = this.DataConverter.Serialize(input),
OrchestrationIdReusePolicy = { },
Copy link
Member

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?

};

DateTimeOffset? startAt = options?.StartAt;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ public override async Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
cancellation.ThrowIfCancellationRequested();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@ public override Task<string> ScheduleNewOrchestrationInstanceAsync(
TaskName orchestratorName,
object? input = null,
StartOrchestrationOptions? options = null,
HashSet<string>? orchestrationIdReusePolicy = null,
CancellationToken cancellation = default)
{
throw new NotImplementedException();
Expand Down
Loading