1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 16:16:44 +00:00
This commit is contained in:
2020-06-10 23:23:09 +08:00
parent da33e1bffd
commit 6f4e4ba77b
4 changed files with 25 additions and 2 deletions

View File

@@ -150,6 +150,7 @@ func (pool *ResourcePool) init(conf Configuration) {
if len(nodes) == 0 {
left = append(left, pool.batchJobs[0])
pool.batchJobs = pool.batchJobs[1:]
log.Info("cannot find a valid allocation, remove a job randomly")
continue
}
for i, task := range job.Tasks {
@@ -688,6 +689,9 @@ func (pool *ResourcePool) acquireResource(job Job) []NodeStatus {
}
return pool.doAcquireResource(job)
}
pool.batchMu.Lock()
pool.batchJobs = append(pool.batchJobs, job)
pool.batchMu.Unlock()
for {
if _, ok := pool.batchAllocations[job.Name]; ok {
break
@@ -1030,3 +1034,10 @@ func (pool *ResourcePool) SetPreScheduleRatio(ratio float64) bool {
log.Info("enablePreScheduleRatio is updated to ", ratio)
return true
}
func (pool *ResourcePool) DebugDump() map[string]interface{} {
res := map[string]interface{}{}
res["batchJobs"] = pool.batchJobs
res["pools"] = pool.pools
return res
}