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

update fair

This commit is contained in:
Newnius 2020-05-30 19:39:19 +08:00
parent 890982456b
commit 87211ef66b

View File

@ -16,6 +16,7 @@ type SchedulerFair struct {
queues map[string][]Job
queuesMu sync.Mutex
drfyarn bool
enableBorrow bool
IOUs map[string]map[string]*ResourceCount
queuesQuota map[string]*ResourceCount
@ -41,7 +42,8 @@ func (scheduler *SchedulerFair) Start() {
scheduler.history = []*Job{}
scheduler.queues = map[string][]Job{}
scheduler.queues["default"] = []Job{}
scheduler.enableBorrow = true
scheduler.drfyarn = true
scheduler.enableBorrow = false
scheduler.IOUs = map[string]map[string]*ResourceCount{}
scheduler.queuesQuota = map[string]*ResourceCount{}
scheduler.resourceAllocations = map[string]*ResourceCount{}
@ -212,6 +214,19 @@ 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 */
if bestQueue != "" {
numberGPUtmp := 0