Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

completing retries even if minSuccesses are achieved #4338

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 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,10 @@ 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 {

// if we have enough successes, ensure all tasks are in a terminal phase (success or failure)
// before transitioning to the next phase.
if totalSuccesses >= minSuccesses && totalSuccesses+totalPermanentFailures == totalCount {
logger.Infof(ctx, "Array succeeded because totalSuccesses[%v] >= minSuccesses[%v]", totalSuccesses, minSuccesses)
return PhaseWriteToDiscovery
}
Expand Down
18 changes: 18 additions & 0 deletions flyteplugins/go/tasks/plugins/array/core/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,24 @@ func TestSummaryToPhase(t *testing.T) {
core.PhaseRetryableFailure: 5,
},
},
{
// complete retry even though minSuccesses is achieved
"RetryMinSuccessRatio",
PhaseCheckingSubTaskExecutions,
map[core.Phase]int64{
core.PhaseSuccess: 10,
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
Loading