|
|
|
@@ -207,14 +207,15 @@ func downloadModelFromCloudBrainTwo(modelUUID string, jobName string, parentDir |
|
|
|
|
|
|
|
func downloadModelFromCloudBrainOne(modelUUID string, jobName string, parentDir string, trainUrl string) (string, int64, error) { |
|
|
|
modelActualPath := storage.GetMinioPath(jobName, "/model/") |
|
|
|
destKeyNamePrefix := Model_prefix + models.AttachmentRelativePath(modelUUID) + "/" |
|
|
|
size, err := storage.MinioPathCopy(setting.Bucket, modelActualPath, destKeyNamePrefix) |
|
|
|
if err == nil { |
|
|
|
dataActualPath := setting.Bucket + "/" + destKeyNamePrefix |
|
|
|
return dataActualPath, size, nil |
|
|
|
} else { |
|
|
|
return "", 0, nil |
|
|
|
} |
|
|
|
log.Info("modelActualPath=" + modelActualPath) |
|
|
|
//destKeyNamePrefix := Model_prefix + models.AttachmentRelativePath(modelUUID) + "/" |
|
|
|
//size, err := storage.MinioPathCopy(setting.Bucket, modelActualPath, destKeyNamePrefix) |
|
|
|
//if err == nil { |
|
|
|
// dataActualPath := setting.Bucket + "/" + destKeyNamePrefix |
|
|
|
// return dataActualPath, size, nil |
|
|
|
//} else { |
|
|
|
return "", 0, nil |
|
|
|
//} |
|
|
|
} |
|
|
|
|
|
|
|
func DeleteModel(ctx *context.Context) { |
|
|
|
@@ -304,7 +305,7 @@ func DownloadMultiModelFile(ctx *context.Context) { |
|
|
|
} |
|
|
|
|
|
|
|
func downloadFromCloudBrainOne(path string, task *models.AiModelManage, ctx *context.Context, id string) { |
|
|
|
allFile, err := storage.GetAllObjectByBucketAndPrefix(setting.Bucket, path) |
|
|
|
allFile, err := storage.GetAllObjectByBucketAndPrefixMinio(setting.Attachment.Minio.Bucket, path) |
|
|
|
if err == nil { |
|
|
|
//count++ |
|
|
|
models.ModifyModelDownloadCount(id) |
|
|
|
@@ -325,7 +326,7 @@ func downloadFromCloudBrainOne(path string, task *models.AiModelManage, ctx *con |
|
|
|
ctx.ServerError("download file failed:", err) |
|
|
|
return |
|
|
|
} |
|
|
|
body, err := storage.ObsDownloadAFile(setting.Bucket, path+oneFile.FileName) |
|
|
|
body, err := storage.Attachments.Open(oneFile.FileName) |
|
|
|
if err != nil { |
|
|
|
log.Info("download file failed: %s\n", err.Error()) |
|
|
|
ctx.ServerError("download file failed:", err) |
|
|
|
|