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

Commit 550044e

Browse files
authored
Merge pull request #617 from k82cn/automated-cherry-pick-of-#615-upstream-release-0.4
Automated cherry pick of #615: Handled minAvailable task everytime.
2 parents 7f9bbff + cda8c4a commit 550044e

File tree

2 files changed

+6
-16
lines changed

2 files changed

+6
-16
lines changed

pkg/scheduler/actions/allocate/allocate.go

+5-4
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,14 @@ func (alloc *allocateAction) Execute(ssn *framework.Session) {
175175
}
176176
}
177177

178-
if assigned {
179-
jobs.Push(job)
180-
// Handle one assigned task in each loop.
178+
if !assigned {
181179
break
182180
}
183181

184-
// If current task is not assgined, try to fit all rest tasks.
182+
if ssn.JobReady(job) {
183+
jobs.Push(job)
184+
break
185+
}
185186
}
186187

187188
// Added Queue back until no job in Queue.

pkg/scheduler/plugins/gang/gang.go

+1-12
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ func (gp *gangPlugin) OnSessionOpen(ssn *framework.Session) {
107107
for _, preemptee := range preemptees {
108108
job := ssn.Jobs[preemptee.Job]
109109
occupid := readyTaskNum(job)
110-
preemptable := job.MinAvailable <= occupid-1
110+
preemptable := job.MinAvailable <= occupid-1 || job.MinAvailable == 1
111111

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

151-
if !lReady && !rReady {
152-
if lv.CreationTimestamp.Equal(&rv.CreationTimestamp) {
153-
if lv.UID < rv.UID {
154-
return -1
155-
}
156-
} else if lv.CreationTimestamp.Before(&rv.CreationTimestamp) {
157-
return -1
158-
}
159-
return 1
160-
}
161-
162151
return 0
163152
}
164153

0 commit comments

Comments
 (0)