Browse Source

debug

tags/v1.22.6.2
lewis 3 years ago
parent
commit
8eeaf77935
2 changed files with 8 additions and 14 deletions
  1. +1
    -1
      modules/grampus/grampus.go
  2. +7
    -13
      routers/repo/grampus.go

+ 1
- 1
modules/grampus/grampus.go View File

@@ -40,7 +40,7 @@ const (
ProcessorTypeNPU = "npu.huawei.com/NPU"
ProcessorTypeGPU = "nvidia.com/gpu"

CommandPrepareScript = "pwd;cd /tmp;wget https://git.openi.org.cn/lewis/script_for_grampus/archive/master.zip;unzip master.zip;cd script_for_grampus;chmod 777 sync_for_arm;"
CommandPrepareScript = "pwd;cd /tmp;mkdir output;mkdir code;mkdir dataset;wget https://git.openi.org.cn/lewis/script_for_grampus/archive/master.zip;unzip master.zip;cd script_for_grampus;chmod 777 sync_for_arm uploader_for_grampus;"
CodeArchiveName = "master.zip"
)



+ 7
- 13
routers/repo/grampus.go View File

@@ -216,7 +216,6 @@ func grampusParamCheckCreateTrainJob(form auth.CreateGrampusTrainJobForm) error
}

func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrainJobForm) {
VersionOutputPath := modelarts.GetOutputPathByCount(modelarts.TotalVersionCount)
displayJobName := form.DisplayJobName
jobName := util.ConvertDisplayJobNameToJobName(displayJobName)
uuid := form.Attachment
@@ -298,20 +297,13 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain
}

//todo: upload code (send to file_server todo this work?)
if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.OutputPath + VersionOutputPath + "/"); err != nil {
if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.OutputPath); err != nil {
log.Error("Failed to obsMkdir_output: %s (%v)", repo.FullName(), err)
grampusTrainJobNpuNewDataPrepare(ctx)
ctx.RenderWithErr("Failed to obsMkdir_output", tplGrampusTrainJobNPUNew, &form)
return
}

if err := obsMkdir(setting.CodePathPrefix + jobName + modelarts.LogPath + VersionOutputPath + "/"); err != nil {
log.Error("Failed to obsMkdir_log: %s (%v)", repo.FullName(), err)
grampusTrainJobNpuNewDataPrepare(ctx)
ctx.RenderWithErr("Failed to obsMkdir_log", tplGrampusTrainJobNPUNew, &form)
return
}

if err := uploadCodeToObs(codeLocalPath, jobName, ""); err != nil {
log.Error("Failed to uploadCodeToObs: %s (%v)", repo.FullName(), err)
grampusTrainJobNpuNewDataPrepare(ctx)
@@ -321,7 +313,7 @@ func GrampusTrainJobNpuCreate(ctx *context.Context, form auth.CreateGrampusTrain

//prepare command
//todo: download code, download dataset, unzip dataset, exec code, upload model
command, err := generateCommand(repo.Name, grampus.ProcessorTypeNPU, codeObsPath+cloudbrain.DefaultBranchName+".zip", dataObsPath+attachment.Name, bootFile, params, "", attachment.Name)
command, err := generateCommand(repo.Name, grampus.ProcessorTypeNPU, codeObsPath+cloudbrain.DefaultBranchName+".zip", dataObsPath+attachment.Name, bootFile, params, setting.CodePathPrefix+jobName+modelarts.OutputPath, attachment.Name)
log.Info(command)

commitID, _ := ctx.Repo.GitRepo.GetBranchCommitID(branchName)
@@ -545,7 +537,7 @@ func GrampusGetLog(ctx *context.Context) {
return
}

func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile, paramSrc, outputPath, datasetName string) (string, error) {
func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile, paramSrc, outputObsPath, datasetName string) (string, error) {
var command string

command += grampus.CommandPrepareScript
@@ -558,7 +550,7 @@ func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile
}

//unzip code & dataset
commandUnzip := "cd dataset;unzip " + datasetName + ";cd ../code;unzip master.zip;"
commandUnzip := "cd /tmp/dataset;unzip " + datasetName + ";cd /tmp/code;unzip master.zip;"
command += commandUnzip

//exec code
@@ -581,10 +573,12 @@ func generateCommand(repoName, processorType, codeObsPath, dataObsPath, bootFile
}
}

commandCode := "cd " + repoName + ";python " + bootFile + paramCode
commandCode := "cd " + repoName + ";python " + bootFile + paramCode + ";"
command += commandCode

//upload models
commandUpload := "cd /tmp/script_for_grampus/;./uploader_for_grampus " + setting.Bucket + " " + outputObsPath + " " + "/tmp/output/;"
command += commandUpload

return command, nil
}


Loading…
Cancel
Save