Browse Source

提交代码

tags/v1.22.12.2^2
ychao_1983 3 years ago
parent
commit
4ddd3abab3
3 changed files with 18 additions and 57 deletions
  1. +4
    -29
      modules/cloudbrain/cloudbrain.go
  2. +2
    -1
      modules/setting/setting.go
  3. +12
    -27
      routers/repo/cloudbrain.go

+ 4
- 29
modules/cloudbrain/cloudbrain.go View File

@@ -30,12 +30,11 @@ const (
BenchMarkResourceID = 1
Snn4imagenetMountPath = "/snn4imagenet"
BrainScoreMountPath = "/brainscore"
Snn4EcosetMountPath = "/snn4ecoset"
TaskInfoName = "/taskInfo"
Snn4imagenetCommand = `/opt/conda/bin/python /snn4imagenet/testSNN_script.py --modelname '%s' --modelpath '/pretrainmodel' --modeldescription '%s' >/model/benchmark-log.txt`
BrainScoreCommand = `bash /brainscore/brainscore_test_par4shSrcipt.sh -b '%s' -n '%s' -p '/pretrainmodel' -d '%s' >/model/benchmark-log.txt`
SubTaskName = "task1"
Snn4imagenetCommand = `/opt/conda/bin/python /code/testSNN_script.py --modelname '%s' --modelpath '/pretrainmodel/%s' --modeldescription '%s' >/model/benchmark-log.txt`
BrainScoreCommand = `bash /code/brainscore_test_par4shSrcipt.sh -b '%s' -n '%s' -p '/pretrainmodel/%s' -d '%s' >/model/benchmark-log.txt`
Snn4EcosetCommand = `/opt/conda/bin/python /code/testSNN_script_user.py --datapath '/dataset' --modelname '%s' --modelpath '/pretrainmodel/%s' --modeldescription '%s' >/model/benchmark-log.txt`
SubTaskName = "task1"

Success = "S000"

@@ -61,7 +60,6 @@ type GenerateCloudBrainTaskReq struct {
ModelPath string
BenchmarkPath string
Snn4ImageNetPath string
Snn4EcosetPath string
BrainScorePath string
JobType string
Description string
@@ -258,20 +256,6 @@ func GenerateTask(req GenerateCloudBrainTaskReq) (string, error) {
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.Snn4ImageNetPath,
MountPath: Snn4imagenetMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.BrainScorePath,
MountPath: BrainScoreMountPath,
ReadOnly: true,
},
},
{
HostPath: models.StHostPath{
Path: req.ResultPath,
@@ -290,15 +274,6 @@ func GenerateTask(req GenerateCloudBrainTaskReq) (string, error) {
},
})
}
if req.Snn4EcosetPath != "" { //ecoset benchmark
volumes = append(volumes, models.Volume{
HostPath: models.StHostPath{
Path: req.Snn4EcosetPath,
MountPath: Snn4EcosetMountPath,
ReadOnly: true,
},
})
}

if len(req.DatasetInfos) == 1 {
volumes = append(volumes, models.Volume{


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

@@ -1524,7 +1524,8 @@ func NewContext() {
IsSnn4EcosetEnabled = sec.Key("ENABLED").MustBool(false)
Snn4EcosetOwner = sec.Key("OWNER").MustString("")
Snn4EcosetName = sec.Key("NAME").MustString("")
Snn4imagenetServerHost = sec.Key("HOST").MustString("")
Snn4EcosetServerHost = sec.Key("HOST").MustString("")
Snn4AttachmentName = sec.Key("DATASET").MustString("")

sec = Cfg.Section("blockchain")
BlockChainHost = sec.Key("HOST").MustString("http://192.168.136.66:3302/")


+ 12
- 27
routers/repo/cloudbrain.go View File

@@ -2477,8 +2477,7 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
image := form.Image
jobType := form.JobType
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath
branchName := cloudbrain.DefaultBranchName

repo := ctx.Repo.Repository

tpl := tplCloudBrainBenchmarkNew
@@ -2539,42 +2538,31 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
}
}

downloadCode(repo, codePath, branchName)
uploadCodeToMinio(codePath+"/", jobName, cloudbrain.CodeMountPath+"/")

modelPath := setting.JobPath + jobName + cloudbrain.ModelMountPath + "/"
mkModelPath(modelPath)
uploadCodeToMinio(modelPath, jobName, cloudbrain.ModelMountPath+"/")

snn4imagenetPath := setting.JobPath + jobName + cloudbrain.Snn4imagenetMountPath
codePath := setting.JobPath + jobName + cloudbrain.CodeMountPath
if setting.IsSnn4imagenetEnabled && jobType == string(models.JobTypeSnn4imagenet) {
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, snn4imagenetPath, "", "", ctx.User.Name)
uploadCodeToMinio(snn4imagenetPath+"/", jobName, cloudbrain.Snn4imagenetMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, trimSpaceNewlineInString(form.Description))
downloadRateCode(repo, jobName, setting.Snn4imagenetOwner, setting.Snn4imagenetName, codePath, "", "", ctx.User.Name)
uploadCodeToMinio(codePath+"/", jobName, cloudbrain.CodeMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4imagenetCommand, displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))

}
benchmarkChildTypeID := 0
brainScorePath := setting.JobPath + jobName + cloudbrain.BrainScoreMountPath
if setting.IsBrainScoreEnabled && jobType == string(models.JobTypeBrainScore) {
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, brainScorePath, "", "", ctx.User.Name)
uploadCodeToMinio(brainScorePath+"/", jobName, cloudbrain.BrainScoreMountPath+"/")
downloadRateCode(repo, jobName, setting.BrainScoreOwner, setting.BrainScoreName, codePath, "", "", ctx.User.Name)
uploadCodeToMinio(codePath+"/", jobName, cloudbrain.CodeMountPath+"/")
benchmarkChildTypeID = form.BenchmarkChildTypeID
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description))
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))
}
snn4EcosetPath := setting.JobPath + jobName + cloudbrain.Snn4EcosetMountPath
var uuid string
var datasetInfos map[string]models.DatasetInfo
var datasetNames string
if setting.IsSnn4EcosetEnabled && jobType == string(models.JobTypeSnn4Ecoset) {
err = downloadRateCode(repo, jobName, setting.Snn4EcosetOwner, setting.Snn4EcosetName, snn4EcosetPath, "", "", ctx.User.Name)
if err != nil {
log.Error("load benchmark code failed", err)
cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr(ctx.Tr("repo.cloudbrain.morethanonejob"), tpl, &form)
return
}
err = uploadCodeToMinio(snn4EcosetPath+"/", jobName, cloudbrain.Snn4EcosetMountPath+"/")
command = fmt.Sprintf(cloudbrain.BrainScoreCommand, getBrainRegion(benchmarkChildTypeID), displayJobName, trimSpaceNewlineInString(form.Description))
downloadRateCode(repo, jobName, setting.Snn4EcosetOwner, setting.Snn4EcosetName, codePath, "", "", ctx.User.Name)
uploadCodeToMinio(codePath+"/", jobName, cloudbrain.CodeMountPath+"/")
command = fmt.Sprintf(cloudbrain.Snn4EcosetCommand, displayJobName, form.CkptName, trimSpaceNewlineInString(form.Description))

attachment, err := getEcosetAttachment()
if err != nil {
@@ -2619,12 +2607,9 @@ func ModelBenchmarkCreate(ctx *context.Context, form auth.CreateCloudBrainForm)
CodePath: storage.GetMinioPath(jobName, cloudbrain.CodeMountPath+"/"),
ModelPath: storage.GetMinioPath(jobName, cloudbrain.ModelMountPath+"/"),
BenchmarkPath: storage.GetMinioPath(jobName, cloudbrain.BenchMarkMountPath+"/"),
Snn4ImageNetPath: storage.GetMinioPath(jobName, cloudbrain.Snn4imagenetMountPath+"/"),
BrainScorePath: storage.GetMinioPath(jobName, cloudbrain.BrainScoreMountPath+"/"),
Snn4EcosetPath: storage.GetMinioPath(jobName, cloudbrain.Snn4EcosetMountPath+"/"),
JobType: jobType,
Description: form.Description,
BranchName: branchName,
BranchName: cloudbrain.DefaultBranchName,
BootFile: form.BootFile,
Params: form.Params,
CommitID: "",


Loading…
Cancel
Save