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

Automated cherry pick of #600: Fixed duplicated queue in preempt/reclaim action. #601

Merged
merged 1 commit into from
Feb 25, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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