|
|
@@ -1062,12 +1062,12 @@ func CloudBrainBenchmarkNew(ctx *context.Context) { |
|
|
|
ctx.HTML(200, tplCloudBrainBenchmarkNew) |
|
|
|
} |
|
|
|
|
|
|
|
func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (string, error) { |
|
|
|
uuid := "" |
|
|
|
func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (*models.BenchmarkDataset, error) { |
|
|
|
var childInfo *models.BenchmarkDataset |
|
|
|
if benchmarkTypes == nil { |
|
|
|
if err := json.Unmarshal([]byte(setting.BenchmarkTypes), &benchmarkTypes); err != nil { |
|
|
|
log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err) |
|
|
|
return uuid, err |
|
|
|
return childInfo, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
@@ -1076,7 +1076,7 @@ func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (string, |
|
|
|
if benchmarkType.Id == benchmarkTypeID { |
|
|
|
for _, childType := range benchmarkType.Second { |
|
|
|
if childType.Id == benchmarkChildTypeID { |
|
|
|
uuid = childType.Attachment |
|
|
|
childInfo = childType |
|
|
|
isExist = true |
|
|
|
break |
|
|
|
} |
|
|
@@ -1087,10 +1087,10 @@ func getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID int) (string, |
|
|
|
|
|
|
|
if !isExist { |
|
|
|
log.Error("no such benchmark_type_id&benchmark_child_type_id") |
|
|
|
return uuid, errors.New("no such benchmark_type_id&benchmark_child_type_id") |
|
|
|
return childInfo, errors.New("no such benchmark_type_id&benchmark_child_type_id") |
|
|
|
} |
|
|
|
|
|
|
|
return uuid, nil |
|
|
|
return childInfo, nil |
|
|
|
} |
|
|
|
|
|
|
|
func getBenchmarkGpuQueue(gpuQueue string) (string, error) { |
|
|
@@ -1161,7 +1161,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF |
|
|
|
return |
|
|
|
} |
|
|
|
|
|
|
|
uuid, err := getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID) |
|
|
|
childInfo, err := getBenchmarkAttachment(benchmarkTypeID, benchmarkChildTypeID) |
|
|
|
if err != nil { |
|
|
|
log.Error("getBenchmarkAttachment failed:%v", err, ctx.Data["MsgID"]) |
|
|
|
cloudBrainNewDataPrepare(ctx) |
|
|
@@ -1240,7 +1240,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if err := downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BenchmarkName, benchmarkPath, form.BenchmarkCategory, gpuType); err != nil { |
|
|
|
if err := downloadRateCode(repo, jobName, childInfo.Owner, childInfo.RepoName, benchmarkPath, form.BenchmarkCategory, gpuType); err != nil { |
|
|
|
log.Error("downloadRateCode failed, %v", err, ctx.Data["MsgID"]) |
|
|
|
//cloudBrainNewDataPrepare(ctx) |
|
|
|
//ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) |
|
|
@@ -1254,7 +1254,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF |
|
|
|
//return |
|
|
|
} |
|
|
|
|
|
|
|
err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), |
|
|
|
err = cloudbrain.GenerateTask(ctx, jobName, image, command, childInfo.Attachment, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), |
|
|
|
storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"), |
|
|
|
storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"), storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"), |
|
|
|
storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"), string(models.JobTypeBenchmark), gpuQueue, form.Description, |
|
|
|