-
Notifications
You must be signed in to change notification settings - Fork 321
add tag to TaskScheduledEvent #1211
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
Merged
Merged
Changes from 5 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6c41917
add tag to TaskScheduledEvent
YunchuWang f81d966
Merge branch 'main' into wangbill/atag
YunchuWang ef1255a
more changes
YunchuWang 57f2847
fb builder pattern
YunchuWang 24906c5
Merge branch 'main' of https://github.com/YunchuWang/durabletask into…
YunchuWang 4b07512
some fb
YunchuWang 1e21e06
bump minor ver
YunchuWang b150b6e
scheduletaskoptions unit tests
YunchuWang 30ef922
unit tests for taskorchestrationcontext
YunchuWang 746a2d4
test 'none'
YunchuWang 7371edd
Revert "test 'none'"
YunchuWang a74b7cc
refresh ci test build
YunchuWang 59e07a8
Revert "refresh ci test build"
YunchuWang bc9eb06
refresh ci test build
YunchuWang 2f831f1
remove test
YunchuWang 38764f9
Revert "refresh ci test build"
YunchuWang ab7e8b2
Update src/DurableTask.Core/ScheduleTaskOptions.cs
YunchuWang 1705e11
retry deep copy
YunchuWang 62ef0bf
revert ver
YunchuWang 9e9f5a8
refresh ci test build
YunchuWang 8d1b873
fix tests
YunchuWang 2a18a39
Revert "refresh ci test build"
YunchuWang 69f96a4
revert ver..
YunchuWang File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,143 @@ | ||
| // ---------------------------------------------------------------------------------- | ||
| // Copyright Microsoft Corporation | ||
| // Licensed under the Apache License, Version 2.0 (the "License"); | ||
| // you may not use this file except in compliance with the License. | ||
| // You may obtain a copy of the License at | ||
| // http://www.apache.org/licenses/LICENSE-2.0 | ||
| // Unless required by applicable law or agreed to in writing, software | ||
| // distributed under the License is distributed on an "AS IS" BASIS, | ||
| // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| // See the License for the specific language governing permissions and | ||
| // limitations under the License. | ||
| // ---------------------------------------------------------------------------------- | ||
|
|
||
| #nullable enable | ||
|
|
||
| namespace DurableTask.Core | ||
| { | ||
| using System; | ||
| using System.Collections.Generic; | ||
|
|
||
| /// <summary> | ||
| /// Options for scheduling a task. | ||
| /// </summary> | ||
| public class ScheduleTaskOptions | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="ScheduleTaskOptions"/> class. | ||
| /// </summary> | ||
| protected ScheduleTaskOptions() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Dictionary of key/value tags associated with this instance. | ||
| /// </summary> | ||
| public IDictionary<string, string>? Tags { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the retry options for the scheduled task. | ||
| /// </summary> | ||
| public RetryOptions? RetryOptions { get; internal set; } | ||
|
|
||
| /// <summary> | ||
| /// Creates a new builder for constructing a <see cref="ScheduleTaskOptions"/> instance. | ||
| /// </summary> | ||
| /// <returns>A new builder for creating schedule task options.</returns> | ||
| public static Builder CreateBuilder() | ||
| { | ||
| return new Builder(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Builder class for creating instances of <see cref="ScheduleTaskOptions"/>. | ||
| /// </summary> | ||
| public class Builder | ||
| { | ||
| private readonly ScheduleTaskOptions options; | ||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="Builder"/> class. | ||
| /// </summary> | ||
| internal Builder() | ||
| { | ||
| this.options = new ScheduleTaskOptions(); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the tags for the schedule task options. | ||
| /// </summary> | ||
| /// <param name="tags">The dictionary of key/value tags.</param> | ||
| /// <returns>The builder instance.</returns> | ||
| public Builder WithTags(IDictionary<string, string> tags) | ||
| { | ||
| this.options.Tags = tags; | ||
YunchuWang marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| return this; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Adds a tag to the schedule task options. | ||
| /// </summary> | ||
| /// <param name="key">The tag key.</param> | ||
| /// <param name="value">The tag value.</param> | ||
| /// <returns>The builder instance.</returns> | ||
| public Builder AddTag(string key, string value) | ||
| { | ||
| if (this.options.Tags == null) | ||
| { | ||
| this.options.Tags = new Dictionary<string, string>(); | ||
| } | ||
|
|
||
| this.options.Tags[key] = value; | ||
| return this; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the retry options for the scheduled task. | ||
| /// </summary> | ||
| /// <param name="retryOptions">The retry options to use.</param> | ||
| /// <returns>The builder instance.</returns> | ||
| public Builder WithRetryOptions(RetryOptions retryOptions) | ||
| { | ||
| this.options.RetryOptions = retryOptions; | ||
| return this; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the retry options for the scheduled task with the specified parameters. | ||
| /// </summary> | ||
| /// <param name="firstRetryInterval">Timespan to wait for the first retry.</param> | ||
| /// <param name="maxNumberOfAttempts">Max number of attempts to retry.</param> | ||
| /// <returns>The builder instance.</returns> | ||
| public Builder WithRetryOptions(TimeSpan firstRetryInterval, int maxNumberOfAttempts) | ||
| { | ||
| this.options.RetryOptions = new RetryOptions(firstRetryInterval, maxNumberOfAttempts); | ||
| return this; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Sets the retry options for the scheduled task with the specified parameters and configures additional properties. | ||
| /// </summary> | ||
| /// <param name="firstRetryInterval">Timespan to wait for the first retry.</param> | ||
| /// <param name="maxNumberOfAttempts">Max number of attempts to retry.</param> | ||
| /// <param name="configureRetryOptions">Action to configure additional retry option properties.</param> | ||
| /// <returns>The builder instance.</returns> | ||
| public Builder WithRetryOptions(TimeSpan firstRetryInterval, int maxNumberOfAttempts, Action<RetryOptions> configureRetryOptions) | ||
| { | ||
| var retryOptions = new RetryOptions(firstRetryInterval, maxNumberOfAttempts); | ||
| configureRetryOptions?.Invoke(retryOptions); | ||
| this.options.RetryOptions = retryOptions; | ||
| return this; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Builds the <see cref="ScheduleTaskOptions"/> instance. | ||
| /// </summary> | ||
| /// <returns>The built schedule task options.</returns> | ||
| public ScheduleTaskOptions Build() | ||
| { | ||
| return this.options; | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.