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

update fair

This commit is contained in:
2020-05-28 14:26:08 +08:00
parent f43f4e24ad
commit 10a46937c9
2 changed files with 70 additions and 14 deletions

View File

@@ -50,10 +50,12 @@ type ResourcePool struct {
bindingsMu sync.Mutex
utils map[string][]UtilGPUTimeSeries
TotalGPU int
TotalGPUMu sync.Mutex
UsingGPU int
UsingGPUMu sync.Mutex
TotalGPU int
TotalGPUMu sync.Mutex
TotalCPU int
TotalMemory int
UsingGPU int
UsingGPUMu sync.Mutex
enableShare bool
enableShareRatio float64
@@ -73,6 +75,9 @@ func (pool *ResourcePool) init(conf Configuration) {
pool.TotalGPU = 0
pool.UsingGPU = 0
pool.TotalCPU = 0
pool.TotalMemory = 0
pool.enableShare = true
pool.enableShareRatio = 0.75
pool.enablePreSchedule = true
@@ -129,6 +134,8 @@ func (pool *ResourcePool) checkDeadNodes() {
pool.TotalGPUMu.Lock()
if _, ok := seg.Nodes[k]; ok {
pool.TotalGPU -= len(seg.Nodes[k].Status)
pool.TotalCPU -= seg.Nodes[k].NumCPU
pool.TotalMemory -= seg.Nodes[k].MemTotal
}
pool.TotalGPUMu.Unlock()
delete(seg.Nodes, k)
@@ -240,6 +247,8 @@ func (pool *ResourcePool) saveStatusHistory() {
pool.TotalGPUMu.Lock()
pool.TotalGPU = TotalGPU
pool.TotalCPU = TotalCPU
pool.TotalMemory = TotalMemGPU
pool.TotalGPUMu.Unlock()
time.Sleep(time.Second * 60)
}
@@ -307,6 +316,8 @@ func (pool *ResourcePool) update(node NodeStatus) {
/* TODO: double check node do belong to this seg */
pool.TotalGPUMu.Lock()
pool.TotalGPU += len(node.Status)
pool.TotalCPU += node.NumCPU
pool.TotalMemory += node.MemTotal
pool.TotalGPUMu.Unlock()
log.Info("node ", node.ClientID, " is online")
}