1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 16:16:44 +00:00

update fair

This commit is contained in:
2020-05-28 19:38:46 +08:00
parent 4a91d71c26
commit 911796da2c
3 changed files with 25 additions and 23 deletions

View File

@@ -276,17 +276,17 @@ func (scheduler *SchedulerFair) AcquireResource(job Job) []NodeStatus {
func (scheduler *SchedulerFair) ReleaseResource(job Job, agent NodeStatus) {
InstanceOfResourcePool().releaseResource(job, agent)
go func(res NodeStatus) {
scheduler.resourceAllocationsMu.Lock()
if _, ok := scheduler.resourceAllocations[job.Group]; !ok {
scheduler.resourceAllocations[job.Group] = &ResourceCount{}
}
cnt, _ := scheduler.resourceAllocations[job.Group]
cnt.CPU -= res.NumCPU
cnt.Memory -= res.MemTotal
cnt.NumberGPU -= len(res.Status)
scheduler.resourceAllocationsMu.Unlock()
}(agent)
scheduler.resourceAllocationsMu.Lock()
if _, ok := scheduler.resourceAllocations[job.Group]; !ok {
scheduler.resourceAllocations[job.Group] = &ResourceCount{}
}
cnt, _ := scheduler.resourceAllocations[job.Group]
cnt.CPU -= agent.NumCPU
cnt.Memory -= agent.MemTotal
cnt.NumberGPU -= len(agent.Status)
scheduler.resourceAllocationsMu.Unlock()
go func() {
scheduler.UpdateQuota()
}()