1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-06-07 22:31:55 +00:00

update fair

This commit is contained in:
Newnius 2020-05-31 11:08:16 +08:00
parent 6681a2ae00
commit 14d33bb67c

View File

@ -79,7 +79,22 @@ func (scheduler *SchedulerFair) Start() {
bestQueue := "" bestQueue := ""
maxNumberGPU := math.MaxInt64 maxNumberGPU := math.MaxInt64
maxNumberCPU := math.MaxInt64 maxNumberCPU := math.MaxInt64
/* drf of yarn/kube-batch */
if scheduler.drfyarn {
least := math.MaxInt32
for queue, allocate := range scheduler.resourceAllocations {
if jobs, ok := scheduler.queues[queue]; ok && len(jobs) > 0 {
if bestQueue == "" || allocate.NumberGPU < least {
bestQueue = queue
least = allocate.NumberGPU
}
}
}
}
/* phase 1: execute jobs using self quota */ /* phase 1: execute jobs using self quota */
if bestQueue == "" {
for queue, jobs := range scheduler.queues { for queue, jobs := range scheduler.queues {
/* find largest job */ /* find largest job */
if len(jobs) > 0 { if len(jobs) > 0 {
@ -102,6 +117,7 @@ func (scheduler *SchedulerFair) Start() {
} }
} }
} }
}
/* phase 2: borrow */ /* phase 2: borrow */
if bestQueue == "" && scheduler.enableBorrow { if bestQueue == "" && scheduler.enableBorrow {
@ -214,19 +230,6 @@ func (scheduler *SchedulerFair) Start() {
} }
} }
/* drf of yarn/kube-batch */
if bestQueue == "" && scheduler.drfyarn {
least := math.MaxInt32
for queue, allocate := range scheduler.resourceAllocations {
if jobs, ok := scheduler.queues[queue]; ok && len(jobs) > 0 {
if bestQueue == "" || allocate.NumberGPU < least {
bestQueue = queue
least = allocate.NumberGPU
}
}
}
}
/* launch that job */ /* launch that job */
if bestQueue != "" { if bestQueue != "" {
numberGPUtmp := 0 numberGPUtmp := 0