Skip to content

Commit c3c2707

Browse files
authored
Merge pull request kubernetes-retired#647 from hex108/refactor
In allocate, skip adding Job if its queue is not found
2 parents 2234ece + e9f3a3b commit c3c2707

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

pkg/scheduler/actions/allocate/allocate.go

+8-4
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,16 @@ func (alloc *allocateAction) Execute(ssn *framework.Session) {
4646
jobsMap := map[api.QueueID]*util.PriorityQueue{}
4747

4848
for _, job := range ssn.Jobs {
49-
if _, found := jobsMap[job.Queue]; !found {
50-
jobsMap[job.Queue] = util.NewPriorityQueue(ssn.JobOrderFn)
51-
}
52-
5349
if queue, found := ssn.Queues[job.Queue]; found {
5450
queues.Push(queue)
51+
} else {
52+
glog.Warningf("Skip adding Job <%s/%s> because its queue %s is not found",
53+
job.Namespace, job.Name, job.Queue)
54+
continue
55+
}
56+
57+
if _, found := jobsMap[job.Queue]; !found {
58+
jobsMap[job.Queue] = util.NewPriorityQueue(ssn.JobOrderFn)
5559
}
5660

5761
glog.V(4).Infof("Added Job <%s/%s> into Queue <%s>", job.Namespace, job.Name, job.Queue)

0 commit comments

Comments
 (0)