Skip to content

Commit

Permalink
[Bug] fix ArrayNode state's TaskPhase reset (#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]>
  • Loading branch information
pvditt authored Jul 19, 2024
1 parent 0b39839 commit fe879f2
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 fe879f2

Please sign in to comment.