Browse Source

删除本地数据。

Signed-off-by: zouap <zouap@pcl.ac.cn>
tags/v1.22.7.1
zouap 3 years ago
parent
commit
9e170ead3d
1 changed files with 15 additions and 3 deletions
  1. +15
    -3
      routers/repo/ai_model_convert.go

+ 15
- 3
routers/repo/ai_model_convert.go View File

@@ -384,7 +384,7 @@ func createGpuTrainJob(modelConvert *models.AiModelConvert, ctx *context.Context
log.Info("local dataset path:" + relatetiveModelPath) log.Info("local dataset path:" + relatetiveModelPath)
downloadFromObsToLocal(model, relatetiveModelPath) downloadFromObsToLocal(model, relatetiveModelPath)
uploadCodeToMinio(relatetiveModelPath+"/", modelConvert.ID, "/dataset/") uploadCodeToMinio(relatetiveModelPath+"/", modelConvert.ID, "/dataset/")
//TODO delete
deleteLocalDir(relatetiveModelPath)
dataActualPath = setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/dataset" dataActualPath = setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/dataset"
} }
} }
@@ -396,7 +396,8 @@ func createGpuTrainJob(modelConvert *models.AiModelConvert, ctx *context.Context
downloadConvertCode(setting.ModelConvert.ConvertRepoPath, codePath, DefaultBranchName) downloadConvertCode(setting.ModelConvert.ConvertRepoPath, codePath, DefaultBranchName)


uploadCodeToMinio(codePath+"/", modelConvert.ID, CodeMountPath+"/") uploadCodeToMinio(codePath+"/", modelConvert.ID, CodeMountPath+"/")
//TODO delete
deleteLocalDir(codePath)

minioCodePath := setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/code" minioCodePath := setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/code"
log.Info("minio codePath=" + minioCodePath) log.Info("minio codePath=" + minioCodePath)


@@ -405,7 +406,8 @@ func createGpuTrainJob(modelConvert *models.AiModelConvert, ctx *context.Context
mkModelPath(modelPath) mkModelPath(modelPath)


uploadCodeToMinio(modelPath, modelConvert.ID, ModelMountPath+"/") uploadCodeToMinio(modelPath, modelConvert.ID, ModelMountPath+"/")
//TODO delete
deleteLocalDir(modelPath)

minioModelPath := setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/model" minioModelPath := setting.Attachment.Minio.RealPath + setting.Attachment.Minio.Bucket + "/" + setting.CBCodePathPrefix + modelConvert.ID + "/model"
log.Info("minio model path=" + minioModelPath) log.Info("minio model path=" + minioModelPath)


@@ -476,6 +478,16 @@ func createGpuTrainJob(modelConvert *models.AiModelConvert, ctx *context.Context
return nil return nil
} }


func deleteLocalDir(dirpath string) {
//TODO delete
_err := os.RemoveAll(dirpath)
if _err == nil {
log.Info("Delete local file:" + dirpath)
} else {
log.Info("Delete local file error: path=" + dirpath)
}
}

func getGpuModelConvertCommand(name string, modelFile string, modelConvert *models.AiModelConvert, bootfile string) string { func getGpuModelConvertCommand(name string, modelFile string, modelConvert *models.AiModelConvert, bootfile string) string {
var command string var command string




Loading…
Cancel
Save