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-25 11:28:07 +08:00
parent e094fda5c4
commit 3032da0baf
2 changed files with 4 additions and 5 deletions

View File

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

View File

@ -470,8 +470,7 @@ 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 {
var tmp map[string]float64
err = json.Unmarshal([]byte(msg.Labels), &tmp)
tmp := msg.Labels
if v, ok := tmp["cpu"]; ok {
req.CPU = int(math.Ceil(v / 100))
}