Skip to content

Commit

Permalink
Merge pull request kubernetes-retired#600 from k82cn/preempt_queue_issue
Browse files Browse the repository at this point in the history
Fixed duplicated queue in preempt action.
  • Loading branch information
k8s-ci-robot authored Feb 25, 2019
2 parents 5d28570 + 711985b commit 4bc2804
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pkg/scheduler/actions/preempt/preempt.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,15 @@ func (alloc *preemptAction) Execute(ssn *framework.Session) {
preemptorTasks := map[api.JobID]*util.PriorityQueue{}

var underRequest []*api.JobInfo
var queues []*api.QueueInfo
queues := map[api.QueueID]*api.QueueInfo{}

for _, job := range ssn.Jobs {
if queue, found := ssn.QueueIndex[job.Queue]; !found {
continue
} else {
} else if _, existed := queues[queue.UID]; !existed {
glog.V(3).Infof("Added Queue <%s> for Job <%s/%s>",
queue.Name, job.Namespace, job.Name)
queues = append(queues, queue)
queues[queue.UID] = queue
}

if len(job.TaskStatusIndex[api.Pending]) != 0 {
Expand Down
11 changes: 8 additions & 3 deletions pkg/scheduler/actions/reclaim/reclaim.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ func (alloc *reclaimAction) Execute(ssn *framework.Session) {
defer glog.V(3).Infof("Leaving Reclaim ...")

queues := util.NewPriorityQueue(ssn.QueueOrderFn)
queueMap := map[api.QueueID]*api.QueueInfo{}

preemptorsMap := map[api.QueueID]*util.PriorityQueue{}
preemptorTasks := map[api.JobID]*util.PriorityQueue{}
Expand All @@ -57,9 +58,13 @@ func (alloc *reclaimAction) Execute(ssn *framework.Session) {
job.Queue, job.Namespace, job.Name)
continue
} else {
glog.V(4).Infof("Added Queue <%s> for Job <%s/%s>",
queue.Name, job.Namespace, job.Name)
queues.Push(queue)
if _, existed := queueMap[queue.UID]; !existed {
glog.V(4).Infof("Added Queue <%s> for Job <%s/%s>",
queue.Name, job.Namespace, job.Name)

queueMap[queue.UID] = queue
queues.Push(queue)
}
}

if len(job.TaskStatusIndex[api.Pending]) != 0 {
Expand Down

0 comments on commit 4bc2804

Please sign in to comment.