| @@ -550,18 +550,18 @@ type GetResourceSpecsResult struct { | |||||
| ErrorMsg string `json:"error_msg"` | ErrorMsg string `json:"error_msg"` | ||||
| IsSuccess bool `json:"is_success"` | IsSuccess bool `json:"is_success"` | ||||
| SpecTotalCount int `json:"spec_total_count"` | SpecTotalCount int `json:"spec_total_count"` | ||||
| Specs []Specs `json:"specs"` | |||||
| Specs []Specs `json:"specs"` | |||||
| } | } | ||||
| type Specs struct { | type Specs struct { | ||||
| ErrorCode string `json:"core"` | |||||
| ErrorMsg string `json:"cpu"` | |||||
| IsSuccess bool `json:"no_resource"` | |||||
| JobName string `json:"gpu_type"` | |||||
| JobID int64 `json:"spec_id"` | |||||
| Status int `json:"gpu_num"` | |||||
| ResourceID string `json:"spec_code"` | |||||
| VersionName string `json:"storage"` | |||||
| Core string `json:"core"` | |||||
| Cpu string `json:"cpu"` | |||||
| IsNoResource bool `json:"no_resource"` | |||||
| GpuType string `json:"gpu_type"` | |||||
| SpecID int64 `json:"spec_id"` | |||||
| GpuNum int `json:"gpu_num"` | |||||
| SpecCode string `json:"spec_code"` | |||||
| Storage string `json:"storage"` | |||||
| MaxNum int `json:"max_num"` | MaxNum int `json:"max_num"` | ||||
| UnitNum int `json:"unit_num"` | UnitNum int `json:"unit_num"` | ||||
| InterfaceType int `json:"interface_type"` | InterfaceType int `json:"interface_type"` | ||||
| @@ -319,6 +319,11 @@ sendjob: | |||||
| goto sendjob | goto sendjob | ||||
| } | } | ||||
| if res.StatusCode() != http.StatusOK { | |||||
| log.Error("createTrainJob failed(%d)", res.StatusCode()) | |||||
| return &result, fmt.Errorf("createTrainJob failed(%d)", res.StatusCode()) | |||||
| } | |||||
| if !result.IsSuccess { | if !result.IsSuccess { | ||||
| log.Error("createTrainJob failed(%s): %s", result.ErrorCode, result.ErrorMsg) | log.Error("createTrainJob failed(%s): %s", result.ErrorCode, result.ErrorMsg) | ||||
| return &result, fmt.Errorf("createTrainJob failed(%s): %s", result.ErrorCode, result.ErrorMsg) | return &result, fmt.Errorf("createTrainJob failed(%s): %s", result.ErrorCode, result.ErrorMsg) | ||||
| @@ -351,6 +356,8 @@ sendjob: | |||||
| goto sendjob | goto sendjob | ||||
| } | } | ||||
| log.Info("", res.StatusCode(), res.RawResponse.Body) | |||||
| if res.StatusCode() != http.StatusOK { | if res.StatusCode() != http.StatusOK { | ||||
| log.Error("GetResourceSpecs failed(%d)", res.StatusCode()) | log.Error("GetResourceSpecs failed(%d)", res.StatusCode()) | ||||
| return &result, fmt.Errorf("GetResourceSpecs failed(%d)", res.StatusCode()) | return &result, fmt.Errorf("GetResourceSpecs failed(%d)", res.StatusCode()) | ||||
| @@ -325,6 +325,16 @@ func TrainJobNew(ctx *context.Context) { | |||||
| return | return | ||||
| } | } | ||||
| ctx.Data["flavor_infos"] = flavorInfos.Info | ctx.Data["flavor_infos"] = flavorInfos.Info | ||||
| res, err := modelarts.GetResourceSpecs() | |||||
| if err != nil { | |||||
| log.Error("GetResourceSpecs failed: %v", err) | |||||
| ctx.ServerError("GetResourceSpecs failed:", err) | |||||
| return | |||||
| } | |||||
| log.Info("", res.SpecTotalCount) | |||||
| ctx.HTML(200, tplModelArtsTrainJobNew) | ctx.HTML(200, tplModelArtsTrainJobNew) | ||||
| } | } | ||||