Browse Source

adjust

tags/v1.22.1.3
lewis 3 years ago
parent
commit
8bd295c747
3 changed files with 13 additions and 10 deletions
  1. +2
    -0
      models/cloudbrain.go
  2. +2
    -1
      modules/cloudbrain/cloudbrain.go
  3. +9
    -9
      routers/repo/cloudbrain.go

+ 2
- 0
models/cloudbrain.go View File

@@ -403,6 +403,8 @@ type BenchmarkDataset struct {
Id int `json:"id"`
Value string `json:"value"` //二级算法类型名称
Attachment string `json:"attachment"` //数据集的uuid
Owner string `json:"owner"` //评估脚本所在仓库的拥有者
RepoName string `json:"repo_name"` //评估脚本所在仓库的名称
}

type GpuInfos struct {


+ 2
- 1
modules/cloudbrain/cloudbrain.go View File

@@ -17,7 +17,8 @@ const (
Command = `pip3 install jupyterlab==2.2.5 -i https://pypi.tuna.tsinghua.edu.cn/simple;
service ssh stop;
jupyter lab --no-browser --ip=0.0.0.0 --allow-root --notebook-dir="/code" --port=80 --LabApp.token="" --LabApp.allow_origin="self https://cloudbrain.pcl.ac.cn"`
CommandBenchmark = `echo "start benchmark";python /code/test.py;echo "end benchmark"`
//CommandBenchmark = `echo "start benchmark";python /code/test.py;echo "end benchmark"`
CommandBenchmark = `echo "start benchmark";cd /benchmark && bash run_bk.sh;echo "end benchmark"`
CodeMountPath = "/code"
DataSetMountPath = "/dataset"
ModelMountPath = "/model"


+ 9
- 9
routers/repo/cloudbrain.go View File

@@ -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,


Loading…
Cancel
Save