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

fix: Revert "fix: regression in memoization without outputs (#12130)" #12201

Merged
merged 1 commit into from
Nov 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
19 changes: 12 additions & 7 deletions workflow/controller/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -351,15 +351,20 @@ func (woc *wfOperationCtx) executeDAG(ctx context.Context, nodeName string, tmpl
return node, err
}
if outputs != nil {
node, err = woc.wf.GetNodeByName(nodeName)
if err != nil {
woc.log.Errorf("unable to get node by name for %s", nodeName)
return nil, err
}
node.Outputs = outputs
woc.wf.Status.Nodes.Set(node.ID, *node)
}
if node.MemoizationStatus != nil {
c := woc.controller.cacheFactory.GetCache(controllercache.ConfigMapCache, node.MemoizationStatus.CacheName)
err := c.Save(ctx, node.MemoizationStatus.Key, node.ID, node.Outputs)
if err != nil {
woc.log.WithFields(log.Fields{"nodeID": node.ID}).WithError(err).Error("Failed to save node outputs to cache")
node.Phase = wfv1.NodeError
if node.MemoizationStatus != nil {
c := woc.controller.cacheFactory.GetCache(controllercache.ConfigMapCache, node.MemoizationStatus.CacheName)
err := c.Save(ctx, node.MemoizationStatus.Key, node.ID, node.Outputs)
if err != nil {
woc.log.WithFields(log.Fields{"nodeID": node.ID}).WithError(err).Error("Failed to save node outputs to cache")
node.Phase = wfv1.NodeError
}
}
}

Expand Down
20 changes: 11 additions & 9 deletions workflow/controller/steps.go
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,21 @@ func (woc *wfOperationCtx) executeSteps(ctx context.Context, nodeName string, tm
if err != nil {
return node, err
}

if outputs != nil {
node, err := woc.wf.GetNodeByName(nodeName)
if err != nil {
return nil, err
}
Copy link
Contributor

@agilgur5 agilgur5 Nov 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

per my root cause analysis, we can have a more targeted fix by just reverting this part (in both steps and DAGs), so that we retain the memoization fix below. then I can solve the root cause in a follow-up PR

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've done this in #12203

#12130 should not have gone in to 3.4 branch at all (as memoization without outputs was a feat), so this revert should be done on 3.4, but #12203 should be in 3.5.

node.Outputs = outputs
woc.addOutputsToGlobalScope(node.Outputs)
woc.wf.Status.Nodes.Set(node.ID, *node)
}

if node.MemoizationStatus != nil {
c := woc.controller.cacheFactory.GetCache(controllercache.ConfigMapCache, node.MemoizationStatus.CacheName)
err := c.Save(ctx, node.MemoizationStatus.Key, node.ID, node.Outputs)
if err != nil {
woc.log.WithFields(log.Fields{"nodeID": node.ID}).WithError(err).Error("Failed to save node outputs to cache")
node.Phase = wfv1.NodeError
if node.MemoizationStatus != nil {
c := woc.controller.cacheFactory.GetCache(controllercache.ConfigMapCache, node.MemoizationStatus.CacheName)
err := c.Save(ctx, node.MemoizationStatus.Key, node.ID, node.Outputs)
if err != nil {
woc.log.WithFields(log.Fields{"nodeID": node.ID}).WithError(err).Error("Failed to save node outputs to cache")
node.Phase = wfv1.NodeError
}
}
}

Expand Down