Skip to content

Commit

Permalink
fix: mark PodGroup completed when pod fails
Browse files Browse the repository at this point in the history
Signed-off-by: bood <boodweb@gmail.com>
  • Loading branch information
bood committed Nov 8, 2024
1 parent 1ab6088 commit d2d3f0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pkg/scheduler/framework/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -263,16 +263,16 @@ 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)
}
}

// 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 {
Expand Down

0 comments on commit d2d3f0a

Please sign in to comment.