1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-06-06 22:01:55 +00:00
This commit is contained in:
Newnius 2020-06-24 23:52:23 +08:00
parent 00b2858180
commit 9609c500dc
2 changed files with 10 additions and 3 deletions

View File

@ -91,3 +91,9 @@ type MsgJobReq struct {
MemGPU int `json:"gpu_mem"`
BW int `json:"bw"`
}
type MsgJobReqPredict struct {
Code int `json:"code"`
Error string `json:"error"`
Labels map[string]float64 `json:"labels"`
}

View File

@ -467,9 +467,10 @@ func (optimizer *Optimizer) PredictReq(job Job, role string) MsgJobReq {
}
req := MsgJobReq{CPU: 4, Mem: 4096, UtilGPU: 100, MemGPU: 8192, BW: 0}
var tmp map[string]float64
err = json.Unmarshal([]byte(string(body)), &tmp)
if err == nil {
var msg MsgJobReqPredict
err = json.Unmarshal([]byte(string(body)), &msg)
if err == nil && msg.Code == 0 {
tmp := msg.Labels
if v, ok := tmp["cpu"]; ok {
req.CPU = int(math.Ceil(v / 100))
}