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

update shceduler_fair

This commit is contained in:
Newnius 2019-08-01 14:03:17 +08:00
parent f5ef9b00a6
commit c1c6a8eafb

View File

@ -184,7 +184,7 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task) NodeStatus {
if _, ok := scheduler.resourceAllocations[job.Group]; !ok { if _, ok := scheduler.resourceAllocations[job.Group]; !ok {
scheduler.resourceAllocations[job.Group] = &ResourceCount{} scheduler.resourceAllocations[job.Group] = &ResourceCount{}
} }
cnt, _ :=scheduler.resourceAllocations[job.Group] cnt, _ := scheduler.resourceAllocations[job.Group]
cnt.CPU += res.MemTotal cnt.CPU += res.MemTotal
cnt.Memory += res.NumCPU cnt.Memory += res.NumCPU
for _, v := range res.Status { for _, v := range res.Status {
@ -341,6 +341,9 @@ func (scheduler *SchedulerFair) UpdateNextQueue() {
} }
for k, v := range scheduler.resourceAllocations { for k, v := range scheduler.resourceAllocations {
if t, ok := scheduler.queues[k]; !ok || len(t) == 0 {
continue
}
tmp := 0.0 tmp := 0.0
tmp += float64(v.CPU) / CPU tmp += float64(v.CPU) / CPU
tmp += float64(v.Memory) / Memory tmp += float64(v.Memory) / Memory