From c8695658cdf9f5e5c5fcdafc0a13ed8caf3e0117 Mon Sep 17 00:00:00 2001 From: Jun Gong Date: Mon, 18 Mar 2019 11:29:36 +0800 Subject: [PATCH] In allocate, skip adding Job if its queue is not found --- pkg/scheduler/actions/allocate/allocate.go | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/pkg/scheduler/actions/allocate/allocate.go b/pkg/scheduler/actions/allocate/allocate.go index 30e3d858f..912d20bb7 100644 --- a/pkg/scheduler/actions/allocate/allocate.go +++ b/pkg/scheduler/actions/allocate/allocate.go @@ -46,12 +46,16 @@ func (alloc *allocateAction) Execute(ssn *framework.Session) { jobsMap := map[api.QueueID]*util.PriorityQueue{} for _, job := range ssn.Jobs { - if _, found := jobsMap[job.Queue]; !found { - jobsMap[job.Queue] = util.NewPriorityQueue(ssn.JobOrderFn) - } - if queue, found := ssn.Queues[job.Queue]; found { queues.Push(queue) + } else { + glog.Warningf("Skip adding Job <%s/%s> because its queue %s is not found", + job.Namespace, job.Name, job.Queue) + continue + } + + if _, found := jobsMap[job.Queue]; !found { + jobsMap[job.Queue] = util.NewPriorityQueue(ssn.JobOrderFn) } glog.V(4).Infof("Added Job <%s/%s> into Queue <%s>", job.Namespace, job.Name, job.Queue)