-
Notifications
You must be signed in to change notification settings - Fork 1.5k
add time-skipping configuration to UpdateWorkflowExecutionOptions
#9944
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -691,6 +691,7 @@ func (s *Starter) handleUseExistingWorkflowOnConflictOptions( | |
| links, | ||
| "", // identity | ||
| nil, // priority | ||
| nil, // timeSkippingConfig | ||
| ) | ||
| return api.UpdateWorkflowWithoutWorkflowTask, err | ||
|
Contributor
Author
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. use existing execution on wfID conflict doesn't involve ts config changes |
||
| }, | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -151,7 +151,7 @@ func MergeAndApply( | |
| if mergedOpts.GetVersioningOverride() == nil { | ||
| unsetOverride = true | ||
| } | ||
| _, err = ms.AddWorkflowExecutionOptionsUpdatedEvent(mergedOpts.GetVersioningOverride(), unsetOverride, "", nil, nil, identity, mergedOpts.GetPriority()) | ||
| _, err = ms.AddWorkflowExecutionOptionsUpdatedEvent(mergedOpts.GetVersioningOverride(), unsetOverride, "", nil, nil, identity, mergedOpts.GetPriority(), mergedOpts.GetTimeSkippingConfig()) | ||
| if err != nil { | ||
| return nil, hasChanges, err | ||
| } | ||
|
|
@@ -172,6 +172,11 @@ func getOptionsFromMutableState(ms historyi.MutableState) *workflowpb.WorkflowEx | |
| opts.Priority = cloned | ||
| } | ||
| } | ||
| if tsInfo := ms.GetExecutionInfo().GetTimeSkippingInfo(); tsInfo != nil { | ||
| if cloned, ok := proto.Clone(tsInfo.GetConfig()).(*workflowpb.TimeSkippingConfig); ok { | ||
| opts.TimeSkippingConfig = cloned | ||
| } | ||
| } | ||
| return opts | ||
| } | ||
|
|
||
|
|
@@ -230,5 +235,54 @@ func mergeWorkflowExecutionOptions( | |
| mergeInto.Priority.FairnessWeight = mergeFrom.Priority.GetFairnessWeight() | ||
| } | ||
|
|
||
| // ==== Time Skipping Config | ||
| // nil means "no change" — only update if the caller provided an explicit value. | ||
| if _, ok := updateFields["timeSkippingConfig"]; ok { | ||
|
Contributor
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. Can updateFields contain something like
Contributor
Author
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. this commit : d72dcb3 |
||
| if mergeFrom.GetTimeSkippingConfig() != nil { | ||
| mergeInto.TimeSkippingConfig = mergeFrom.GetTimeSkippingConfig() | ||
| } | ||
| } | ||
|
|
||
| if _, ok := updateFields["timeSkippingConfig.enabled"]; ok { | ||
| if mergeInto.TimeSkippingConfig == nil { | ||
| mergeInto.TimeSkippingConfig = &workflowpb.TimeSkippingConfig{} | ||
| } | ||
| mergeInto.TimeSkippingConfig.Enabled = mergeFrom.GetTimeSkippingConfig().GetEnabled() | ||
| } | ||
|
|
||
| if _, ok := updateFields["timeSkippingConfig.disablePropagation"]; ok { | ||
| if mergeInto.TimeSkippingConfig == nil { | ||
| mergeInto.TimeSkippingConfig = &workflowpb.TimeSkippingConfig{} | ||
| } | ||
| mergeInto.TimeSkippingConfig.DisablePropagation = mergeFrom.GetTimeSkippingConfig().GetDisablePropagation() | ||
| } | ||
|
|
||
| if _, ok := updateFields["timeSkippingConfig.maxSkippedDuration"]; ok { | ||
| if mergeInto.TimeSkippingConfig == nil { | ||
| mergeInto.TimeSkippingConfig = &workflowpb.TimeSkippingConfig{} | ||
| } | ||
| mergeInto.TimeSkippingConfig.Bound = &workflowpb.TimeSkippingConfig_MaxSkippedDuration{ | ||
| MaxSkippedDuration: mergeFrom.GetTimeSkippingConfig().GetMaxSkippedDuration(), | ||
| } | ||
| } | ||
|
|
||
| if _, ok := updateFields["timeSkippingConfig.maxElapsedDuration"]; ok { | ||
| if mergeInto.TimeSkippingConfig == nil { | ||
| mergeInto.TimeSkippingConfig = &workflowpb.TimeSkippingConfig{} | ||
| } | ||
| mergeInto.TimeSkippingConfig.Bound = &workflowpb.TimeSkippingConfig_MaxElapsedDuration{ | ||
| MaxElapsedDuration: mergeFrom.GetTimeSkippingConfig().GetMaxElapsedDuration(), | ||
| } | ||
| } | ||
|
|
||
| if _, ok := updateFields["timeSkippingConfig.maxTargetTime"]; ok { | ||
| if mergeInto.TimeSkippingConfig == nil { | ||
| mergeInto.TimeSkippingConfig = &workflowpb.TimeSkippingConfig{} | ||
| } | ||
| mergeInto.TimeSkippingConfig.Bound = &workflowpb.TimeSkippingConfig_MaxTargetTime{ | ||
| MaxTargetTime: mergeFrom.GetTimeSkippingConfig().GetMaxTargetTime(), | ||
| } | ||
| } | ||
|
|
||
| return mergeInto, nil | ||
| } | ||
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.
If
frontend.TimeSkippingEnabledis turned off during a workflow execution, validateTimeSkippingConfig will not allow disabling time skipping for a workflow. validateTimeSkippingConfig will return an error in that case. User will not be able to disable time skipping explicitly iffrontend.TimeSkippingEnabledis false. Is that the intended behaviour?Uh oh!
There was an error while loading. Please reload this page.
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.
yes, that is my understanding of how dynamic config feature flag works -> we don't allow users turn on a feature and have a bunch of workflows running with this feature and then turn off the feature and still want to try to manipulate the feature. this kind of flexibility will make the system complicated.
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 may understand this incorrectly. cc @yycptt for a confirmation
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.
Yeah that makes sense. The one I pointed out is not a normal case scenario.
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 guess we don't support removing a feature flag after users enable it? I don't know I feel that will be weird.