diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 1c4fee707..a1ecf46db 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -33,7 +33,7 @@ const ( tplCloudBrainShowModels base.TplName = "repo/cloudbrain/models/index" tplCloudBrainBenchmarkIndex base.TplName = "repo/cloudbrain/benchmark/index" - tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new" + tplCloudBrainBenchmarkNew base.TplName = "repo/cloudbrain/benchmark/new" ) var ( @@ -950,8 +950,8 @@ func CloudBrainBenchmarkIndex(ctx *context.Context) { Page: page, PageSize: setting.UI.IssuePagingNum, }, - RepoID: repo.ID, - Type: models.TypeCloudBrainOne, + RepoID: repo.ID, + Type: models.TypeCloudBrainOne, JobTypes: jobTypes, }) if err != nil { @@ -979,7 +979,6 @@ func GetChildTypes(ctx *context.Context) { resultCode := "-1" errMsg := "" childTypes := "" - // for { if benchmarkTypes == nil { @@ -991,11 +990,17 @@ func GetChildTypes(ctx *context.Context) { } var isExist bool - - for id, _ := range benchmarkTypes.BenchmarkType { + for id, benchmarkType := range benchmarkTypes.BenchmarkType { if id == benchmarkTypeID { isExist = true - //childTypesInfo = benchmarkType.Second + temp, err := json.Marshal(benchmarkType.Second) + if err != nil { + log.Error("json.Unmarshal BenchmarkTypes(%s) failed:%v", setting.BenchmarkTypes, err, ctx.Data["MsgID"]) + errMsg = "system error" + break + } + childTypes = string(temp) + resultCode = "0" break } } @@ -1012,7 +1017,7 @@ func GetChildTypes(ctx *context.Context) { ctx.JSON(200, map[string]string{ "result_code": resultCode, "error_msg": errMsg, - "child_types": childTypes, + "child_types": childTypes, }) } @@ -1025,6 +1030,10 @@ func CloudBrainBenchmarkNew(ctx *context.Context) { ctx.HTML(200, tplCloudBrainBenchmarkNew) } +func getBenchmarkAttachment() error { + return nil +} + func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { ctx.Data["PageIsCloudBrain"] = true jobName := form.JobName @@ -1072,6 +1081,7 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF } } repo := ctx.Repo.Repository + os.RemoveAll(codePath) if err := downloadCode(repo, codePath); err != nil { log.Error("system error, %v", err, ctx.Data["MsgID"]) cloudBrainNewDataPrepare(ctx) @@ -1096,16 +1106,16 @@ func CloudBrainBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainF if err := downloadRateCode(repo, jobName, setting.BenchmarkOwner, setting.BenchmarkName, benchmarkPath, form.BenchmarkCategory, gpuType); err != nil { log.Error("system error, %v", err, ctx.Data["MsgID"]) - cloudBrainNewDataPrepare(ctx) - ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) - return + //cloudBrainNewDataPrepare(ctx) + //ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) + //return } if err := uploadCodeToMinio(benchmarkPath+"/", jobName, cloudbrain.BenchMarkMountPath+"/"); err != nil { log.Error("system error, %v", err, ctx.Data["MsgID"]) - cloudBrainNewDataPrepare(ctx) - ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) - return + //cloudBrainNewDataPrepare(ctx) + //ctx.RenderWithErr("system error", tplCloudBrainBenchmarkNew, &form) + //return } err = cloudbrain.GenerateTask(ctx, jobName, image, command, uuid, storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"), diff --git a/routers/routes/routes.go b/routers/routes/routes.go index a76328fd7..8b4a75acd 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -990,7 +990,7 @@ func RegisterRoutes(m *macaron.Macaron) { }) m.Get("/create", reqRepoCloudBrainWriter, repo.CloudBrainBenchmarkNew) m.Post("/create", reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainBenchmarkCreate) - m.Get("/get_child_types", reqRepoCloudBrainWriter, repo.GetChildTypes) + m.Get("/get_child_types", repo.GetChildTypes) }) }, context.RepoRef()) m.Group("/modelmanage", func() {