|
|
|
@@ -141,25 +141,28 @@ func asyncToCopyModel(aiTask *models.Cloudbrain, id string, modelSelectedFile st |
|
|
|
if aiTask.ComputeResource == models.NPUResource { |
|
|
|
modelPath, modelSize, err := downloadModelFromCloudBrainTwo(id, aiTask.JobName, "", aiTask.TrainUrl, modelSelectedFile) |
|
|
|
if err != nil { |
|
|
|
updateStatus(id, 0, STATUS_ERROR, modelPath) |
|
|
|
updateStatus(id, 0, STATUS_ERROR, modelPath, err.Error()) |
|
|
|
log.Info("download model from CloudBrainTwo faild." + err.Error()) |
|
|
|
} else { |
|
|
|
updateStatus(id, modelSize, STATUS_FINISHED, modelPath) |
|
|
|
updateStatus(id, modelSize, STATUS_FINISHED, modelPath, "") |
|
|
|
} |
|
|
|
} else if aiTask.ComputeResource == models.GPUResource { |
|
|
|
|
|
|
|
modelPath, modelSize, err := downloadModelFromCloudBrainOne(id, aiTask.JobName, "", aiTask.TrainUrl, modelSelectedFile) |
|
|
|
if err != nil { |
|
|
|
updateStatus(id, 0, STATUS_ERROR, modelPath) |
|
|
|
updateStatus(id, 0, STATUS_ERROR, modelPath, err.Error()) |
|
|
|
log.Info("download model from CloudBrainOne faild." + err.Error()) |
|
|
|
} else { |
|
|
|
updateStatus(id, modelSize, STATUS_FINISHED, modelPath) |
|
|
|
updateStatus(id, modelSize, STATUS_FINISHED, modelPath, "") |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
func updateStatus(id string, modelSize int64, status int, modelPath string) { |
|
|
|
err := models.ModifyModelStatus(id, modelSize, status, modelPath) |
|
|
|
func updateStatus(id string, modelSize int64, status int, modelPath string, statusDesc string) { |
|
|
|
if len(statusDesc) > 400 { |
|
|
|
statusDesc = statusDesc[0:400] |
|
|
|
} |
|
|
|
err := models.ModifyModelStatus(id, modelSize, status, modelPath, statusDesc) |
|
|
|
if err != nil { |
|
|
|
log.Info("update status error." + err.Error()) |
|
|
|
} |
|
|
|
@@ -656,7 +659,6 @@ func queryUserName(intSlice []int64) map[int64]*models.User { |
|
|
|
result[user.ID] = user |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return result |
|
|
|
} |
|
|
|
|
|
|
|
@@ -910,12 +912,17 @@ func QueryOneLevelModelFile(ctx *context.Context) { |
|
|
|
log.Info("TypeCloudBrainTwo list model file.") |
|
|
|
prefix := model.Path[len(setting.Bucket)+1:] |
|
|
|
fileinfos, _ := storage.GetOneLevelAllObjectUnderDir(setting.Bucket, prefix, parentDir) |
|
|
|
if fileinfos == nil { |
|
|
|
fileinfos = make([]storage.FileInfo, 0) |
|
|
|
} |
|
|
|
ctx.JSON(http.StatusOK, fileinfos) |
|
|
|
} else if model.Type == models.TypeCloudBrainOne { |
|
|
|
log.Info("TypeCloudBrainOne list model file.") |
|
|
|
prefix := model.Path[len(setting.Attachment.Minio.Bucket)+1:] |
|
|
|
fileinfos, _ := storage.GetOneLevelAllObjectUnderDirMinio(setting.Attachment.Minio.Bucket, prefix, parentDir) |
|
|
|
if fileinfos == nil { |
|
|
|
fileinfos = make([]storage.FileInfo, 0) |
|
|
|
} |
|
|
|
ctx.JSON(http.StatusOK, fileinfos) |
|
|
|
} |
|
|
|
|
|
|
|
} |