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-06-24 23:58:38 +08:00
parent 9609c500dc
commit e094fda5c4
2 changed files with 5 additions and 4 deletions

View File

@ -93,7 +93,7 @@ type MsgJobReq struct {
}
type MsgJobReqPredict struct {
Code int `json:"code"`
Error string `json:"error"`
Labels map[string]float64 `json:"labels"`
Code int `json:"code"`
Error string `json:"error"`
Labels string `json:"labels"`
}

View File

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