|
|
@@ -84,11 +84,12 @@ func CreateSafetyTask(jobName string, body interface{}) (string, error) { |
|
|
|
SetBody(body). |
|
|
|
SetResult(&jobResult). |
|
|
|
Post(HOST + "/v1/external/eval-standard/create") |
|
|
|
log.Info("url=" + HOST + "/v1/external/eval-standard/create") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
return "", fmt.Errorf("resty create job: %s", err) |
|
|
|
} else { |
|
|
|
log.Info("restult=" + jobResult) |
|
|
|
log.Info("result string=" + jobResult + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
} |
|
|
|
|
|
|
|
responseStr := string(res.Body()) |
|
|
@@ -101,21 +102,22 @@ func CreateSafetyTask(jobName string, body interface{}) (string, error) { |
|
|
|
func GetAlgorithmList() error { |
|
|
|
checkSetting() |
|
|
|
client := getRestyClient() |
|
|
|
|
|
|
|
var taskResult string |
|
|
|
params := make(map[string]interface{}) |
|
|
|
params["appId"] = APPID |
|
|
|
|
|
|
|
res, err := client.R(). |
|
|
|
SetHeader("Content-Type", "application/json"). |
|
|
|
SetHeader("sign", createSign(params, KEY)). |
|
|
|
SetResult(&taskResult). |
|
|
|
Get(HOST + "/v1/external/eval-standard/algorithmList") |
|
|
|
|
|
|
|
log.Info("url=" + HOST + "/v1/external/eval-standard/algorithmList") |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("resty GetJob: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
log.Info("taskResult=" + taskResult) |
|
|
|
responseStr := string(res.Body()) |
|
|
|
log.Info("GetAlgorithmList responseStr=" + responseStr) |
|
|
|
log.Info("GetAlgorithmList responseStr=" + responseStr + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
@@ -123,21 +125,22 @@ func GetAlgorithmList() error { |
|
|
|
func GetTaskStatus(jobID string) error { |
|
|
|
checkSetting() |
|
|
|
client := getRestyClient() |
|
|
|
|
|
|
|
var taskResult string |
|
|
|
params := make(map[string]interface{}) |
|
|
|
params["appId"] = APPID |
|
|
|
|
|
|
|
res, err := client.R(). |
|
|
|
SetHeader("Content-Type", "application/json"). |
|
|
|
SetHeader("sign", createSign(params, KEY)). |
|
|
|
SetResult(&taskResult). |
|
|
|
Get(HOST + "/v1/external/eval-standard/query") |
|
|
|
|
|
|
|
log.Info("url=" + HOST + "/v1/external/eval-standard/query") |
|
|
|
if err != nil { |
|
|
|
return fmt.Errorf("resty GetJob: %v", err) |
|
|
|
} |
|
|
|
|
|
|
|
responseStr := string(res.Body()) |
|
|
|
log.Info("GetTaskStatus responseStr=" + responseStr) |
|
|
|
log.Info("GetTaskStatus responseStr=" + responseStr + " res code=" + fmt.Sprint(res.StatusCode())) |
|
|
|
|
|
|
|
return nil |
|
|
|
} |