Browse Source

Merge remote-tracking branch 'origin/V20220830' into zouap

pull/2727/head
zouap 2 years ago
parent
commit
aebe308ad0
2 changed files with 15 additions and 19 deletions
  1. +1
    -3
      modules/grampus/grampus.go
  2. +14
    -16
      routers/repo/grampus.go

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

@@ -23,9 +23,7 @@ const (
NpuWorkDir = "/cache/" NpuWorkDir = "/cache/"


CommandPrepareScript = ";mkdir -p output;mkdir -p code;mkdir -p dataset;echo \"start loading script\";wget -q https://git.openi.org.cn/OpenIOSSG/script_for_grampus/archive/master.zip;" + CommandPrepareScript = ";mkdir -p output;mkdir -p code;mkdir -p dataset;echo \"start loading script\";wget -q https://git.openi.org.cn/OpenIOSSG/script_for_grampus/archive/master.zip;" +
"echo \"finish loading script\";unzip -q master.zip;cd script_for_grampus;chmod 777 downloader_for_obs uploader_for_obs downloader_for_minio uploader_for_minio;"
//CommandPrepareScript = "pwd;cd /cache;mkdir -p output;mkdir -p code;mkdir -p dataset;echo \"start loading script\";wget -q https://git.openi.org.cn/OpenIOSSG/script_for_grampus/archive/master.zip;" +
// "echo \"finish loading script\";unzip -q master.zip;cd script_for_grampus;chmod 777 downloader_for_obs uploader_for_obs downloader_for_minio uploader_for_minio;"
"echo \"finish loading script\";unzip -q master.zip;cd script_for_grampus;chmod 777 downloader_for_obs uploader_for_npu downloader_for_minio uploader_for_gpu;"


CodeArchiveName = "master.zip" CodeArchiveName = "master.zip"
) )


+ 14
- 16
routers/repo/grampus.go View File

@@ -767,10 +767,6 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo
command += commandDownload command += commandDownload
} }


//check download result
commandCheckRes := "bash -c \"[[ $? -eq 0 ]] && exit 0 || exit -1;\";"
command += commandCheckRes

//unzip code & dataset //unzip code & dataset
toolUnzip := "unzip -q '" toolUnzip := "unzip -q '"
if strings.HasSuffix(datasetName, ".tar.gz") { if strings.HasSuffix(datasetName, ".tar.gz") {
@@ -779,16 +775,22 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo
commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + toolUnzip + datasetName + "';" commandUnzip := "cd " + workDir + "code;unzip -q master.zip;echo \"start to unzip dataset\";cd " + workDir + "dataset;" + toolUnzip + datasetName + "';"
command += commandUnzip command += commandUnzip


//check unzip result
commandCheckRes = "bash -c \"[[ $? -eq 0 ]] && exit 0 || exit -1;\";"
command += commandCheckRes

command += "echo \"unzip finished;start to exec code;\";" command += "echo \"unzip finished;start to exec code;\";"


// set export
var commandExport string
if processorType == grampus.ProcessorTypeNPU {
commandExport = "export bucket=" + setting.Bucket + " && export remote_path=" + outputRemotePath + ";"
} else if processorType == grampus.ProcessorTypeGPU {
commandExport = "export env=" + setting.Grampus.Env + " && export remote_path=" + outputRemotePath + ";"
}

command += commandExport

//exec code //exec code
var parameters models.Parameters var parameters models.Parameters
var paramCode string var paramCode string
param := make([]models.Parameter, 0)
if len(paramSrc) != 0 { if len(paramSrc) != 0 {
err := json.Unmarshal([]byte(paramSrc), &parameters) err := json.Unmarshal([]byte(paramSrc), &parameters)
if err != nil { if err != nil {
@@ -797,10 +799,6 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo
} }


for _, parameter := range parameters.Parameter { for _, parameter := range parameters.Parameter {
param = append(param, models.Parameter{
Label: parameter.Label,
Value: parameter.Value,
})
paramCode += " --" + parameter.Label + "=" + parameter.Value paramCode += " --" + parameter.Label + "=" + parameter.Value
} }
} }
@@ -820,15 +818,15 @@ func generateCommand(repoName, processorType, codeRemotePath, dataRemotePath, bo


//upload models //upload models
if processorType == grampus.ProcessorTypeNPU { if processorType == grampus.ProcessorTypeNPU {
commandUpload := "cd " + workDir + "script_for_grampus/;./uploader_for_obs " + setting.Bucket + " " + outputRemotePath + " " + workDir + "output/;"
commandUpload := "cd " + workDir + "script_for_grampus/;./uploader_for_npu " + setting.Bucket + " " + outputRemotePath + " " + workDir + "output/;"
command += commandUpload command += commandUpload
} else if processorType == grampus.ProcessorTypeGPU { } else if processorType == grampus.ProcessorTypeGPU {
commandUpload := "cd " + workDir + "script_for_grampus/;./uploader_for_minio " + setting.Grampus.Env + " " + outputRemotePath + " " + workDir + "output/;"
commandUpload := "cd " + workDir + "script_for_grampus/;./uploader_for_gpu " + setting.Grampus.Env + " " + outputRemotePath + " " + workDir + "output/;"
command += commandUpload command += commandUpload
} }


//check exec result //check exec result
commandCheckRes = "bash -c \"[[ $result -eq 0 ]] && exit 0 || exit -1\""
commandCheckRes := "bash -c \"[[ $result -eq 0 ]] && exit 0 || exit -1\""
command += commandCheckRes command += commandCheckRes


return command, nil return command, nil


Loading…
Cancel
Save