Skip to content
This repository has been archived by the owner on May 25, 2023. It is now read-only.

Commit

Permalink
Merge pull request #617 from k82cn/automated-cherry-pick-of-#615-upst…
Browse files Browse the repository at this point in the history
…ream-release-0.4

Automated cherry pick of #615: Handled minAvailable task everytime.
  • Loading branch information
k8s-ci-robot authored Mar 4, 2019
2 parents 7f9bbff + cda8c4a commit 550044e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 deletions.
9 changes: 5 additions & 4 deletions pkg/scheduler/actions/allocate/allocate.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,13 +175,14 @@ func (alloc *allocateAction) Execute(ssn *framework.Session) {
}
}

if assigned {
jobs.Push(job)
// Handle one assigned task in each loop.
if !assigned {
break
}

// If current task is not assgined, try to fit all rest tasks.
if ssn.JobReady(job) {
jobs.Push(job)
break
}
}

// Added Queue back until no job in Queue.
Expand Down
13 changes: 1 addition & 12 deletions pkg/scheduler/plugins/gang/gang.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) {
for _, preemptee := range preemptees {
job := ssn.Jobs[preemptee.Job]
occupid := readyTaskNum(job)
preemptable := job.MinAvailable <= occupid-1
preemptable := job.MinAvailable <= occupid-1 || job.MinAvailable == 1

if !preemptable {
glog.V(3).Infof("Can not preempt task <%v/%v> because of gang-scheduling",
Expand Down Expand Up @@ -148,17 +148,6 @@ func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) {
return -1
}

if !lReady && !rReady {
if lv.CreationTimestamp.Equal(&rv.CreationTimestamp) {
if lv.UID < rv.UID {
return -1
}
} else if lv.CreationTimestamp.Before(&rv.CreationTimestamp) {
return -1
}
return 1
}

return 0
}

Expand Down

0 comments on commit 550044e

Please sign in to comment.