|
@@ -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), ¶meters) |
|
|
err := json.Unmarshal([]byte(paramSrc), ¶meters) |
|
|
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 |
|
|