Skip to content

Commit

Permalink
Fixing attempt-count and unit-tests (flyteorg#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
surindersinghp committed Mar 9, 2020
1 parent 6d8fffe commit bc96237
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/controller/nodes/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func (c *nodeExecutor) isEligibleForRetry(nCtx *execContext, nodeStatus v1alpha1
return
}

currentAttempt = nodeStatus.GetAttempts() - nodeStatus.GetSystemFailures()
currentAttempt = (nodeStatus.GetAttempts() + 1) - nodeStatus.GetSystemFailures()
if nCtx.Node().GetRetryStrategy() != nil && nCtx.Node().GetRetryStrategy().MinAttempts != nil {
maxAttempts = uint32(*nCtx.Node().GetRetryStrategy().MinAttempts)
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/controller/nodes/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ func TestNodeExecutor_RecursiveNodeHandler_Recurse(t *testing.T) {

{"(retryablefailure->running", v1alpha1.NodePhaseRetryableFailure, v1alpha1.NodePhaseRunning, executors.NodePhasePending, func() (handler.Transition, error) {
return handler.UnknownTransition, fmt.Errorf("should not be invoked")
}, false, false, core.NodeExecution_RUNNING, 1},
}, false, false, core.NodeExecution_RUNNING, 0},

{"running->failing", v1alpha1.NodePhaseRunning, v1alpha1.NodePhaseFailing, executors.NodePhasePending, func() (handler.Transition, error) {
return handler.DoTransition(handler.TransitionTypeEphemeral, handler.PhaseInfoFailure("code", "reason", nil)), nil
Expand Down Expand Up @@ -1210,6 +1210,7 @@ func Test_nodeExecutor_timeout(t *testing.T) {
ns.On("GetQueuedAt").Return(queuedAtTime)
ns.On("GetLastAttemptStartedAt").Return(queuedAtTime)
ns.OnGetAttempts().Return(0)
ns.OnGetSystemFailures().Return(0)
ns.On("ClearLastAttemptStartedAt").Return()

for _, tt := range tests {
Expand Down

0 comments on commit bc96237

Please sign in to comment.