Skip to content

Commit

Permalink
[Bug] fix ArrayNode state's TaskPhase reset (flyteorg#5451)
Browse files Browse the repository at this point in the history
* set updated array node phase for task exec event

Signed-off-by: Paul Dittamo <[email protected]>

* Revert "set updated array node phase for task exec event"

This reverts commit 9f4306a.

Signed-off-by: Paul Dittamo <[email protected]>

* reset taskPhaseVersion due to nodephase change after emitting event

Signed-off-by: Paul Dittamo <[email protected]>

---------

Signed-off-by: Paul Dittamo <[email protected]>
Signed-off-by: Vladyslav Libov <[email protected]>
  • Loading branch information
pvditt authored and VladyslavLibov committed Aug 16, 2024
1 parent 66b9db9 commit 8b872f2
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions flytepropeller/pkg/controller/nodes/array/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -577,18 +577,20 @@ 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
}

if err := eventRecorder.finalize(ctx, nCtx, taskPhase, arrayNodeState.TaskPhaseVersion, a.eventConfig); err != nil {
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
Expand Down

0 comments on commit 8b872f2

Please sign in to comment.