1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-13 07:46:43 +00:00
This commit is contained in:
2020-05-05 19:12:11 +08:00
parent 74f0b2b053
commit 4579353491

View File

@@ -48,6 +48,8 @@ type SchedulerFair struct {
queuesSchedulingCnt map[string]int queuesSchedulingCnt map[string]int
queueUsingGPU map[string]int queueUsingGPU map[string]int
queuesUsingGPUMu sync.Mutex queuesUsingGPUMu sync.Mutex
mu sync.Mutex
} }
type FairJobSorter []Job type FairJobSorter []Job
@@ -342,6 +344,8 @@ func (scheduler *SchedulerFair) Schedule(job Job) {
} }
func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []NodeStatus) NodeStatus { func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []NodeStatus) NodeStatus {
scheduler.mu.Lock()
defer scheduler.mu.Unlock()
segID := rand.Intn(pool.poolsCount) segID := rand.Intn(pool.poolsCount)
res := NodeStatus{} res := NodeStatus{}
start := &pool.pools[segID] start := &pool.pools[segID]