Skip to content

Commit

Permalink
ensuring all tasks in a terminal state
Browse files Browse the repository at this point in the history
Signed-off-by: Daniel Rammer <[email protected]>
  • Loading branch information
hamersaw committed Nov 6, 2023
1 parent 66625f6 commit d628c19
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion flyteplugins/go/tasks/plugins/array/core/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,8 @@ func SummaryToPhase(ctx context.Context, minSuccesses int64, summary arraystatus
logger.Infof(ctx, "Array is still running and waiting for resources totalWaitingForResources[%v]", totalWaitingForResources)
return PhaseWaitingForResources
}
if totalSuccesses >= minSuccesses && totalRunning == 0 && totalRetryableFailures == 0 {
//if totalSuccesses >= minSuccesses && totalRunning == 0 && totalRetryableFailures == 0 {
if totalSuccesses >= minSuccesses && totalSuccesses+totalPermanentFailures == totalCount {
logger.Infof(ctx, "Array succeeded because totalSuccesses[%v] >= minSuccesses[%v]", totalSuccesses, minSuccesses)
return PhaseWriteToDiscovery
}
Expand Down
11 changes: 10 additions & 1 deletion flyteplugins/go/tasks/plugins/array/core/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ func TestSummaryToPhase(t *testing.T) {
core.PhaseSuccess: 10,
},
},
{
{
"FailedToRetry",
PhaseWriteToDiscoveryThenFail,
map[core.Phase]int64{
Expand All @@ -358,6 +358,15 @@ func TestSummaryToPhase(t *testing.T) {
core.PhaseRetryableFailure: 1,
},
},
{
// ensure all tasks are executed even if minSuccesses is achieved
"ExecuteAllMinSuccessRatio",
PhaseCheckingSubTaskExecutions,
map[core.Phase]int64{
core.PhaseSuccess: 10,
core.PhaseUndefined: 1,
},
},
}

for _, tt := range tests {
Expand Down

0 comments on commit d628c19

Please sign in to comment.