-
Notifications
You must be signed in to change notification settings - Fork 14
Support workflow patching #56
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?
Conversation
Signed-off-by: Albert Callarisa <albert@diagrid.io>
api/orchestration.go
Outdated
| RUNTIME_STATUS_TERMINATED OrchestrationStatus = protos.OrchestrationStatus_ORCHESTRATION_STATUS_TERMINATED | ||
| RUNTIME_STATUS_PENDING OrchestrationStatus = protos.OrchestrationStatus_ORCHESTRATION_STATUS_PENDING | ||
| RUNTIME_STATUS_SUSPENDED OrchestrationStatus = protos.OrchestrationStatus_ORCHESTRATION_STATUS_SUSPENDED | ||
| RUNTIME_STATUS_PENDING_VERSION OrchestrationStatus = protos.OrchestrationStatus_ORCHESTRATION_STATUS_PENDING_VERSION |
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.
Would it not be better to call this PENDING_PATCH_MISSMATCH ?
backend/runtimestate/runtimestate.go
Outdated
| return protos.OrchestrationStatus_ORCHESTRATION_STATUS_SUSPENDED | ||
| } else if s.CompletedEvent != nil { | ||
| return s.CompletedEvent.GetOrchestrationStatus() | ||
| } else if s.IsPendingVersion { |
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.
Q: does suspended supersede pending?
backend/orchestration.go
Outdated
|
|
||
| if results.GetPatchMismatch() { | ||
| _ = runtimestate.AddEvent(wi.State, &protos.HistoryEvent{ | ||
| EventId: -1, |
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.
Unrelated note: we should update Event ID to be optional.
backend/orchestration.go
Outdated
| ExecutionPendingVersion: &protos.ExecutionPendingVersionEvent{}, | ||
| }, | ||
| }) | ||
| w.logger.Warnf("%v: patch mismatch detected; setting version pending for orchestration instance", wi.InstanceID) |
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.
Is this log necessary? At minimum it should be debug I think.
| if os := e.GetOrchestratorStarted(); os != nil { | ||
| os.Patches = results.Patches | ||
| for _, p := range results.Patches.Patches { | ||
| if err := helpers.StartAndEndNewPatchSpan(ctx, p, e.Timestamp.AsTime()); err != 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.
Is there an existing span we would add the patches as attributes to?
client/worker_grpc.go
Outdated
| resp.Actions = results.Actions | ||
| resp.CustomStatus = results.GetCustomStatus() | ||
| resp.Patches = results.GetPatches() | ||
| resp.PatchMismatch = results.GetPatchMismatch() |
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.
Should we signal what patches were mismatched?
task/orchestrator.go
Outdated
| } | ||
| scheduleTask := a.GetScheduleTask() | ||
| if scheduleTask.GetName() != ts.GetName() { | ||
| if len(ctx.patches) > 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.
I don’t think I understand how this is working 🤔
Patch miss match should be evaluated server side.
task/orchestrator.go
Outdated
| } | ||
|
|
||
| func (ctx *OrchestrationContext) IsPatched(patchName string) bool { | ||
| isPatched := slices.Contains(ctx.patches, patchName) |
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.
Patches should be ordered.
task/orchestrator.go
Outdated
| } | ||
|
|
||
| // We're at the end of the history stream, we can run the patched version and save the decision for next rerun | ||
| ctx.newPatches = append(ctx.newPatches, patchName) |
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 use the variable name of patchesTaken and newPatchesTaken?
Signed-off-by: Albert Callarisa <albert@diagrid.io>
fb69eac to
fd5db26
Compare
Implements the patching as described in the versioning proposal.
Quick summary of the changes added in this PR:
ctx.IsPatched(patchName) boolto ongoing workflowsPendingVersionif the orchestrator find a patch mismatchPendingVersionevent when a patch mismatch is foundstate.IsPendingVersionacordingly