From d2d3f0a6e5946ff9a08306e39ca2358456b09274 Mon Sep 17 00:00:00 2001 From: bood Date: Fri, 8 Nov 2024 15:43:55 +0800 Subject: [PATCH] fix: mark PodGroup completed when pod fails Signed-off-by: bood --- pkg/scheduler/framework/session.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/scheduler/framework/session.go b/pkg/scheduler/framework/session.go index 03e40c30fd..294633ba52 100644 --- a/pkg/scheduler/framework/session.go +++ b/pkg/scheduler/framework/session.go @@ -263,7 +263,7 @@ func jobStatus(ssn *Session, jobInfo *api.JobInfo) scheduling.PodGroupStatus { } else { allocated := 0 for status, tasks := range jobInfo.TaskStatusIndex { - if api.AllocatedStatus(status) || status == api.Succeeded { + if api.AllocatedStatus(status) || status == api.Succeeded || status == api.Failed { allocated += len(tasks) } } @@ -271,8 +271,8 @@ func jobStatus(ssn *Session, jobInfo *api.JobInfo) scheduling.PodGroupStatus { // If there're enough allocated resource, it's running if int32(allocated) >= jobInfo.PodGroup.Spec.MinMember { status.Phase = scheduling.PodGroupRunning - // If all allocated tasks is succeeded, it's completed - if len(jobInfo.TaskStatusIndex[api.Succeeded]) == allocated { + // If all allocated tasks is succeeded or failed, it's completed + if len(jobInfo.TaskStatusIndex[api.Succeeded]) + len(jobInfo.TaskStatusIndex[api.Failed]) == allocated { status.Phase = scheduling.PodGroupCompleted } } else if jobInfo.PodGroup.Status.Phase != scheduling.PodGroupInqueue {