Skip to content

Commit

Permalink
considering best-effort pods when calculating ready task number
Browse files Browse the repository at this point in the history
  • Loading branch information
sivanzcw committed Dec 29, 2019
1 parent 59f4d72 commit d5a7c17
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions pkg/scheduler/api/job_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -343,17 +343,19 @@ func (ji *JobInfo) FitError() string {
return reasonMsg
}

// ReadyTaskNum returns the number of tasks that are ready.
// ReadyTaskNum returns the number of tasks that are ready or that is best-effort.
func (ji *JobInfo) ReadyTaskNum() int32 {
occupid := 0
for status, tasks := range ji.TaskStatusIndex {
if AllocatedStatus(status) ||
status == Succeeded {
occupid = occupid + len(tasks)
var occupied int32
for _, task := range ji.Tasks {
if task.InitResreq.IsEmpty() {
occupied++
} else if AllocatedStatus(task.Status) ||
task.Status == Succeeded {
occupied++
}
}

return int32(occupid)
return occupied
}

// WaitingTaskNum returns the number of tasks that are pipelined.
Expand Down

0 comments on commit d5a7c17

Please sign in to comment.