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

update fair

This commit is contained in:
Newnius 2020-05-29 00:27:10 +08:00
parent 21baff3d0e
commit 7f0b3316f0

View File

@ -548,6 +548,9 @@ func (scheduler *SchedulerFair) UpdateQuota() {
/* can clear all */ /* can clear all */
minIOU = totalIOU minIOU = totalIOU
} }
if quota.NumberGPU < minIOU*len(IOUs) {
minIOU = quota.NumberGPU / len(IOUs)
}
for q, IOU := range IOUs { for q, IOU := range IOUs {
if IOU.NumberGPU <= minIOU { if IOU.NumberGPU <= minIOU {
@ -565,6 +568,22 @@ func (scheduler *SchedulerFair) UpdateQuota() {
delete(scheduler.IOUs[queue], q) delete(scheduler.IOUs[queue], q)
} }
} }
if minIOU == 0 {
for q, IOU := range IOUs {
quota.NumberGPU -= 1
scheduler.queuesQuota[q].NumberGPU += 1
IOU.NumberGPU -= 1
log.Info(queue, " pay IOU to ", q, " now ", IOU.NumberGPU)
/* clear */
if IOU.NumberGPU == 0 {
delete(scheduler.IOUs[queue], q)
}
if quota.NumberGPU == 0 {
break
}
}
}
} }
} }