From fe879f236d0a4a5d2f6e62c2fdb6b1f21f94cdd6 Mon Sep 17 00:00:00 2001 From: Paul Dittamo <37558497+pvditt@users.noreply.github.com> Date: Fri, 19 Jul 2024 06:32:39 -0700 Subject: [PATCH] [Bug] fix ArrayNode state's TaskPhase reset (#5451) * set updated array node phase for task exec event Signed-off-by: Paul Dittamo * Revert "set updated array node phase for task exec event" This reverts commit 9f4306a9bc429e39d64c73f23f6fdbd38709229a. Signed-off-by: Paul Dittamo * reset taskPhaseVersion due to nodephase change after emitting event Signed-off-by: Paul Dittamo --------- Signed-off-by: Paul Dittamo --- flytepropeller/pkg/controller/nodes/array/handler.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/flytepropeller/pkg/controller/nodes/array/handler.go b/flytepropeller/pkg/controller/nodes/array/handler.go index 5e571a0c48..315041cb51 100644 --- a/flytepropeller/pkg/controller/nodes/array/handler.go +++ b/flytepropeller/pkg/controller/nodes/array/handler.go @@ -577,11 +577,8 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu taskPhase = idlcore.TaskExecution_FAILED } - // if the ArrayNode phase has changed we need to reset the taskPhaseVersion to 0, otherwise - // increment it if we detect any changes in subNode state. - if currentArrayNodePhase != arrayNodeState.Phase { - arrayNodeState.TaskPhaseVersion = 0 - } else if incrementTaskPhaseVersion { + // increment taskPhaseVersion if we detect any changes in subNode state. + if incrementTaskPhaseVersion { arrayNodeState.TaskPhaseVersion = arrayNodeState.TaskPhaseVersion + 1 } @@ -589,6 +586,11 @@ func (a *arrayNodeHandler) Handle(ctx context.Context, nCtx interfaces.NodeExecu logger.Errorf(ctx, "ArrayNode event recording failed: [%s]", err.Error()) return handler.UnknownTransition, err } + + // if the ArrayNode phase has changed we need to reset the taskPhaseVersion to 0 + if currentArrayNodePhase != arrayNodeState.Phase { + arrayNodeState.TaskPhaseVersion = 0 + } } // update array node status