Browse Source

增加打印。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.10.1^2
zouap 3 years ago
parent
commit
a4a176c8fd
2 changed files with 15 additions and 6 deletions
  1. +7
    -1
      modules/aisafety/resty.go
  2. +8
    -5
      routers/repo/aisafety.go

+ 7
- 1
modules/aisafety/resty.go View File

@@ -157,8 +157,14 @@ func CreateSafetyTask(req TaskReq, jsonstr string) (string, error) {
log.Info("result string=" + " res code=" + fmt.Sprint(res.StatusCode()))
}

return "", nil
reMap := make(map[string]interface{})

err = json.Unmarshal(res.Body(), &reMap)
if err == nil && reMap["code"] == "0" {
dataMap := (reMap["data"]).(map[string]interface{})
return fmt.Sprint(dataMap["serialNo"]), nil
}
return "", nil
}

func GetAlgorithmList() error {


+ 8
- 5
routers/repo/aisafety.go View File

@@ -27,7 +27,6 @@ func CloudBrainAiSafetyCreateTest(ctx *context.Context) {
//if jobType == string(models.JobTypeBenchmark) {
jsonStr, err := getJsonContent("http://192.168.207.34:8065/Test_zap1234/openi_aisafety/raw/branch/master/result/0301.json")
if err == nil {

req := aisafety.TaskReq{
UnionId: id,
EvalName: "test",
@@ -37,11 +36,15 @@ func CloudBrainAiSafetyCreateTest(ctx *context.Context) {
CDName: "cifar10_1000_BA",
BDName: "cifar10_1000",
}

aisafety.GetAlgorithmList()
aisafety.CreateSafetyTask(req, jsonStr)
time.Sleep(time.Duration(2) * time.Second)
aisafety.GetTaskStatus(id)
serialNo, err := aisafety.CreateSafetyTask(req, jsonStr)
if err == nil {
log.Info("serialNo=" + serialNo)
time.Sleep(time.Duration(2) * time.Second)
aisafety.GetTaskStatus(serialNo)
} else {
log.Info("CreateSafetyTask error," + err.Error())
}
}
//}
}


Loading…
Cancel
Save