Browse Source

update

tags/v1.22.1.2
liuzx 3 years ago
parent
commit
b685d6d560
3 changed files with 12 additions and 12 deletions
  1. +1
    -1
      models/attachment.go
  2. +1
    -1
      modules/modelarts/modelarts.go
  3. +10
    -10
      routers/repo/modelarts.go

+ 1
- 1
models/attachment.go View File

@@ -442,7 +442,7 @@ func GetModelArtsUserAttachments(userID int64) ([]*AttachmentUsername, error) {
func getModelArtsTrainAttachments(e Engine, userID int64) ([]*AttachmentUsername, error) {
attachments := make([]*AttachmentUsername, 0, 10)
if err := e.Table("attachment").Join("LEFT", "`user`", "attachment.uploader_id "+
"= `user`.id").Where("attachment.type = ? and uploader_id= ? and attachment.decompress_state = ?", TypeCloudBrainTwo, userID, DecompressStateDone).Find(&attachments); err != nil {
"= `user`.id").Where("attachment.type = ? and (uploader_id= ? or is_private = ?) and attachment.decompress_state = ?", TypeCloudBrainTwo, userID, false, DecompressStateDone).Find(&attachments); err != nil {
return nil, err
}
return attachments, nil


+ 1
- 1
modules/modelarts/modelarts.go View File

@@ -474,7 +474,7 @@ func TransTrainJobStatus(status int) string {
}
}

func GetVersionOutputPathByTotalVersionCount(TotalVersionCount int) (VersionOutputPath string) {
func GetOutputPathByCount(TotalVersionCount int) (VersionOutputPath string) {
talVersionCountToString := fmt.Sprintf("%04d", TotalVersionCount)
VersionOutputPath = "V" + talVersionCountToString
return VersionOutputPath


+ 10
- 10
routers/repo/modelarts.go View File

@@ -752,7 +752,7 @@ func versionErrorDataPrepare(ctx *context.Context, form auth.CreateModelArtsTrai

func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) {
ctx.Data["PageIsTrainJob"] = true
VersionOutputPath := modelarts.GetVersionOutputPathByTotalVersionCount(modelarts.TotalVersionCount)
VersionOutputPath := modelarts.GetOutputPathByCount(modelarts.TotalVersionCount)
jobName := form.JobName
uuid := form.Attachment
description := form.Description
@@ -969,7 +969,7 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ
ctx.ServerError("GetCloudbrainByJobIDAndIsLatestVersion faild:", err)
return
}
VersionOutputPath := modelarts.GetVersionOutputPathByTotalVersionCount(latestTask.TotalVersionCount + 1)
VersionOutputPath := modelarts.GetOutputPathByCount(latestTask.TotalVersionCount + 1)

jobName := form.JobName
uuid := form.Attachment
@@ -1544,7 +1544,7 @@ func getConfigList(perPage, page int, sortBy, order, searchContent, configType s

func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInferenceJobForm) {
ctx.Data["PageIsTrainJob"] = true
VersionOutputPath := modelarts.GetVersionOutputPathByTotalVersionCount(modelarts.TotalVersionCount)
VersionOutputPath := modelarts.GetOutputPathByCount(modelarts.TotalVersionCount)
jobName := form.JobName
uuid := form.Attachment
description := form.Description
@@ -1573,6 +1573,13 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference

ckptUrl := form.TrainUrl + form.CkptName

if err := paramCheckCreateInferenceJob(form); err != nil {
log.Error("paramCheckCreateInferenceJob failed:(%v)", err)
inferenceJobErrorNewDataPrepare(ctx, form)
ctx.RenderWithErr(err.Error(), tplModelArtsInferenceJobNew, &form)
return
}

count, err := models.GetCloudbrainInferenceJobCountByUserID(ctx.User.ID)
if err != nil {
log.Error("GetCloudbrainInferenceJobCountByUserID failed:%v", err, ctx.Data["MsgID"])
@@ -1588,13 +1595,6 @@ func InferenceJobCreate(ctx *context.Context, form auth.CreateModelArtsInference
}
}

if err := paramCheckCreateInferenceJob(form); err != nil {
log.Error("paramCheckCreateInferenceJob failed:(%v)", err)
inferenceJobErrorNewDataPrepare(ctx, form)
ctx.RenderWithErr(err.Error(), tplModelArtsInferenceJobNew, &form)
return
}

//todo: del the codeLocalPath
_, err = ioutil.ReadDir(codeLocalPath)
if err == nil {


Loading…
Cancel
Save