|
@@ -315,10 +315,10 @@ func GetTrainJobLog(jobID string) (string, error) { |
|
|
return logContent, nil |
|
|
return logContent, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func GetGrampusMetrics(jobID string) (models.GetTrainJobMetricStatisticResult, error) { |
|
|
|
|
|
|
|
|
func GetGrampusMetrics(jobID string) (models.NewModelArtsMetricStatisticResult, error) { |
|
|
checkSetting() |
|
|
checkSetting() |
|
|
client := getRestyClient() |
|
|
client := getRestyClient() |
|
|
var result models.GetTrainJobMetricStatisticResult |
|
|
|
|
|
|
|
|
var result models.NewModelArtsMetricStatisticResult |
|
|
res, err := client.R(). |
|
|
res, err := client.R(). |
|
|
SetAuthToken(TOKEN). |
|
|
SetAuthToken(TOKEN). |
|
|
Get(HOST + urlTrainJob + "/" + jobID + "/task/0/replica/0/metrics") |
|
|
Get(HOST + urlTrainJob + "/" + jobID + "/task/0/replica/0/metrics") |
|
@@ -331,12 +331,7 @@ func GetGrampusMetrics(jobID string) (models.GetTrainJobMetricStatisticResult, e |
|
|
return result, fmt.Errorf("json.Unmarshal failed(%s): %v", res.String(), err.Error()) |
|
|
return result, fmt.Errorf("json.Unmarshal failed(%s): %v", res.String(), err.Error()) |
|
|
} |
|
|
} |
|
|
if res.StatusCode() != http.StatusOK { |
|
|
if res.StatusCode() != http.StatusOK { |
|
|
log.Error("Call GrampusMetrics failed(%d):%s(%s)", res.StatusCode(), result.ErrorCode, result.ErrorMsg) |
|
|
|
|
|
return result, fmt.Errorf("Call GrampusMetrics failed(%d):%d(%s)", res.StatusCode(), result.ErrorCode, result.ErrorMsg) |
|
|
|
|
|
} |
|
|
|
|
|
if !result.IsSuccess { |
|
|
|
|
|
log.Error("GetGrampusMetrics(%s) failed", jobID) |
|
|
|
|
|
return result, fmt.Errorf("GetGrampusMetrics failed:%s", result.ErrorMsg) |
|
|
|
|
|
|
|
|
return result, fmt.Errorf("Call GrampusMetrics failed(%d)", res.StatusCode()) |
|
|
} |
|
|
} |
|
|
return result, nil |
|
|
return result, nil |
|
|
} |
|
|
} |
|
|