Skip to content

Commit

Permalink
Handle possibility of nil startedAt time
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom-Newton committed Nov 29, 2023
1 parent d31350d commit bb5bb6f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions flytepropeller/pkg/controller/nodes/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1320,9 +1320,14 @@ 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
}
startedAt := nodeStatus.GetStartedAt().Time
nodeStatus.UpdatePhase(v1alpha1.NodePhaseFailed, metav1.Now(), nodeStatus.GetMessage(), nodeStatus.GetExecutionError())
c.metrics.FailureDuration.Observe(ctx, startedAt, nodeStatus.GetStoppedAt().Time)
t := metav1.Now()

startedAt := nodeStatus.GetStartedAt()
if startedAt == nil {
startedAt = &t
}
nodeStatus.UpdatePhase(v1alpha1.NodePhaseFailed, t, nodeStatus.GetMessage(), nodeStatus.GetExecutionError())
c.metrics.FailureDuration.Observe(ctx, startedAt.Time, nodeStatus.GetStoppedAt().Time)
if nCtx.NodeExecutionMetadata().IsInterruptible() {
c.metrics.InterruptibleNodesTerminated.Inc(ctx)
}
Expand Down

0 comments on commit bb5bb6f

Please sign in to comment.