1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-06-07 14:21:55 +00:00
This commit is contained in:
Newnius 2020-04-30 16:11:34 +08:00
parent cb9f752baf
commit beee8bb286
4 changed files with 34 additions and 4 deletions

View File

@ -36,4 +36,16 @@ GPU is occupied by which job(s)
**UpdateMaxParallelism** **UpdateMaxParallelism**
``` ```
?action=debug_update_parallelism&parallelism=5 ?action=debug_update_parallelism&parallelism=5
```
**getAllPredicts**
```
?action=debug_get_predicts
```
**getAllGPUUtils**
```
?action=debug_get_gpu_utils
``` ```

View File

@ -189,6 +189,20 @@ func serverAPI(w http.ResponseWriter, r *http.Request) {
w.Write(js) w.Write(js)
break break
case "debug_get_predicts":
log.Debug("debug_get_predicts")
js, _ := json.Marshal(InstanceOfOptimizer().getAllPredicts())
w.Header().Set("Content-Type", "application/json")
w.Write(js)
break
case "debug_get_gpu_utils":
log.Debug("debug_get_gpu_utils")
js, _ := json.Marshal(InstanceOfOptimizer().getAllGPUUtils())
w.Header().Set("Content-Type", "application/json")
w.Write(js)
break
default: default:
http.Error(w, "Not Found", http.StatusNotFound) http.Error(w, "Not Found", http.StatusNotFound)
break break

View File

@ -84,8 +84,6 @@ func (optimizer *Optimizer) feed(job string, utils []int) {
predict.Main = predict.Total - predict.Pre - predict.Post predict.Main = predict.Total - predict.Pre - predict.Post
predict.Version++ predict.Version++
} }
log.Info(optimizer.jobUtilsGPU)
log.Info(optimizer.predicts)
}() }()
} }
@ -115,3 +113,11 @@ func (optimizer *Optimizer) predictTime(job string) (*OptimizerJobExecutionTime,
} }
return &OptimizerJobExecutionTime{}, false return &OptimizerJobExecutionTime{}, false
} }
func (optimizer *Optimizer) getAllPredicts() map[string]*OptimizerJobExecutionTime {
return optimizer.predicts
}
func (optimizer *Optimizer) getAllGPUUtils() map[string]int {
return optimizer.jobUtilsGPU
}

View File

@ -314,8 +314,6 @@ func (scheduler *SchedulerFair) ReleaseResource(job Job, agent NodeStatus) {
pool.poolsMu[poolID].Lock() pool.poolsMu[poolID].Lock()
defer pool.poolsMu[poolID].Unlock() defer pool.poolsMu[poolID].Unlock()
log.Info(agent)
node := pool.pools[poolID][agent.ClientID] node := pool.pools[poolID][agent.ClientID]
for _, gpu := range agent.Status { for _, gpu := range agent.Status {
for j := range node.Status { for j := range node.Status {