mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-06-08 06:41:56 +00:00
bug fix
This commit is contained in:
parent
05d2ea3ee5
commit
8d06ddd9a0
@ -52,7 +52,7 @@ func (pool *ResourcePool) start() {
|
|||||||
pool.bindings = map[string]map[string]bool{}
|
pool.bindings = map[string]map[string]bool{}
|
||||||
pool.utils = map[string][]int{}
|
pool.utils = map[string][]int{}
|
||||||
|
|
||||||
pool.poolsCount = 10
|
pool.poolsCount = 100
|
||||||
for i := 0; i < pool.poolsCount; i++ {
|
for i := 0; i < pool.poolsCount; i++ {
|
||||||
pool.pools = append(pool.pools, map[string]NodeStatus{})
|
pool.pools = append(pool.pools, map[string]NodeStatus{})
|
||||||
pool.poolsMu = append(pool.poolsMu, sync.Mutex{})
|
pool.poolsMu = append(pool.poolsMu, sync.Mutex{})
|
||||||
|
@ -170,11 +170,12 @@ func (scheduler *SchedulerFair) Schedule(job Job) {
|
|||||||
|
|
||||||
func (scheduler *SchedulerFair) AcquireResource(job Job, task Task) NodeStatus {
|
func (scheduler *SchedulerFair) AcquireResource(job Job, task Task) NodeStatus {
|
||||||
poolID := rand.Intn(pool.poolsCount)
|
poolID := rand.Intn(pool.poolsCount)
|
||||||
pool.poolsMu[poolID].Lock()
|
|
||||||
defer pool.poolsMu[poolID].Unlock()
|
|
||||||
|
|
||||||
res := NodeStatus{}
|
res := NodeStatus{}
|
||||||
for id, node := range pool.pools[poolID] {
|
|
||||||
|
for i := poolID; i < pool.poolsCount; i++ {
|
||||||
|
pool.poolsMu[i].Lock()
|
||||||
|
flag := false
|
||||||
|
for id, node := range pool.pools[i] {
|
||||||
var available []GPUStatus
|
var available []GPUStatus
|
||||||
for _, status := range node.Status {
|
for _, status := range node.Status {
|
||||||
if status.MemoryTotal-status.MemoryAllocated >= task.MemoryGPU {
|
if status.MemoryTotal-status.MemoryAllocated >= task.MemoryGPU {
|
||||||
@ -196,6 +197,12 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task) NodeStatus {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
flag = true
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pool.poolsMu[i].Unlock()
|
||||||
|
if flag {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user