Skip to content

Commit

Permalink
Create a copy of the error to return
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Nov 15, 2023
1 parent 07c8262 commit ce097d7
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions flytepropeller/pkg/controller/nodes/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,14 +1320,21 @@ func (c *nodeExecutor) HandleNode(ctx context.Context, dag executors.DAGStructur
if err := c.Abort(ctx, h, nCtx, "node failing", false); err != nil {
return interfaces.NodeStatusUndefined, err
}
nodeStartedAt := nodeStatus.GetStartedAt().Time
nodeError := nodeStatus.GetExecutionError()
nodeStatus.UpdatePhase(v1alpha1.NodePhaseFailed, metav1.Now(), nodeStatus.GetMessage(), nodeError)
c.metrics.FailureDuration.Observe(ctx, nodeStartedAt, nodeStatus.GetStoppedAt().Time)
t := metav1.Now()

started := nodeStatus.GetStartedAt()
if started == nil {
started = &t
}

nodeError := *nodeStatus.GetExecutionError()

nodeStatus.UpdatePhase(v1alpha1.NodePhaseFailed, t, nodeStatus.GetMessage(), nodeStatus.GetExecutionError())
c.metrics.FailureDuration.Observe(ctx, started.Time, nodeStatus.GetStoppedAt().Time)
if nCtx.NodeExecutionMetadata().IsInterruptible() {
c.metrics.InterruptibleNodesTerminated.Inc(ctx)
}
return interfaces.NodeStatusFailed(nodeError), nil
return interfaces.NodeStatusFailed(&nodeError), nil
}

if currentPhase == v1alpha1.NodePhaseTimingOut {
Expand Down

0 comments on commit ce097d7

Please sign in to comment.