-
Notifications
You must be signed in to change notification settings - Fork 45
Cascade Terminate and Purge Support #47
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
cgillum
merged 22 commits into
microsoft:main
from
shivamkm07:cascade_terminate_recursive
Dec 22, 2023
Merged
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
1f7746b
Support recursive cascade terminate recursive
shivamkm07 2d9b9d9
Adding new test for recursive terminate
shivamkm07 3308b10
Updating protos to add recursive flag in purge
shivamkm07 45f4eea
Add Recursive purge support
shivamkm07 78095c4
Terminating children before terminating the root orchestration
shivamkm07 5fb6a12
Moving test to orchestration tests
shivamkm07 983baca
Fix bug in purge
shivamkm07 75b8c59
Add purge recursive test
shivamkm07 97f6c19
Fxing some issues in implementation
shivamkm07 426c4a8
Renaming WithRecursive to WithrecursiveTerminate
shivamkm07 b4a73b9
Merging main
shivamkm07 601a418
Empty commit
shivamkm07 625acaa
Returning instanceNotfound error
shivamkm07 f0a592e
Address review comments
shivamkm07 85e1814
Formatting changes
shivamkm07 e90ac73
Test both recursive and non-recursive scenarios
shivamkm07 a14fee6
Correct error message for terminate
shivamkm07 0ee2fd8
Adding comments
shivamkm07 84e2627
Merge branch 'main' into cascade_terminate_recursive
cgillum 1efaffd
Empty commit
shivamkm07 08891c2
Using updated protobuf
shivamkm07 8603a19
Update CHANGELOG.md
cgillum 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
[submodule "submodules/durabletask-protobuf"] | ||
path = submodules/durabletask-protobuf | ||
url = https://github.com/microsoft/durabletask-protobuf | ||
branch = distributed_tracing | ||
branch = main |
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 |
---|---|---|
|
@@ -24,7 +24,7 @@ type TaskHubClient interface { | |
RaiseEvent(ctx context.Context, id api.InstanceID, eventName string, opts ...api.RaiseEventOptions) error | ||
SuspendOrchestration(ctx context.Context, id api.InstanceID, reason string) error | ||
ResumeOrchestration(ctx context.Context, id api.InstanceID, reason string) error | ||
PurgeOrchestrationState(ctx context.Context, id api.InstanceID) error | ||
PurgeOrchestrationState(ctx context.Context, id api.InstanceID, opts ...api.PurgeOptions) error | ||
} | ||
|
||
type backendClient struct { | ||
|
@@ -139,10 +139,9 @@ func (c *backendClient) TerminateOrchestration(ctx context.Context, id api.Insta | |
return fmt.Errorf("failed to configure termination request: %w", err) | ||
} | ||
} | ||
|
||
e := helpers.NewExecutionTerminatedEvent(req.Output, req.Recursive) | ||
if err := c.be.AddNewOrchestrationEvent(ctx, id, e); err != nil { | ||
return fmt.Errorf("failed to add terminate event: %w", err) | ||
return fmt.Errorf("failed to submit termination request:: %w", err) | ||
} | ||
return nil | ||
} | ||
|
@@ -194,8 +193,14 @@ func (c *backendClient) ResumeOrchestration(ctx context.Context, id api.Instance | |
// | ||
// [api.ErrInstanceNotFound] is returned if the specified orchestration instance doesn't exist. | ||
// [api.ErrNotCompleted] is returned if the specified orchestration instance is still running. | ||
func (c *backendClient) PurgeOrchestrationState(ctx context.Context, id api.InstanceID) error { | ||
if err := c.be.PurgeOrchestrationState(ctx, id); err != nil { | ||
func (c *backendClient) PurgeOrchestrationState(ctx context.Context, id api.InstanceID, opts ...api.PurgeOptions) error { | ||
req := &protos.PurgeInstancesRequest{Request: &protos.PurgeInstancesRequest_InstanceId{InstanceId: string(id)}, Recursive: true} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting default behavior to be recursive Purge, similar to terminate |
||
for _, configure := range opts { | ||
if err := configure(req); err != nil { | ||
return fmt.Errorf("failed to configure purge request: %w", err) | ||
} | ||
} | ||
if _, err := purgeOrchestrationState(ctx, c.be, id, req.Recursive); err != nil { | ||
return fmt.Errorf("failed to purge orchestration state: %w", err) | ||
} | ||
return nil | ||
|
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.