| @@ -73,7 +73,7 @@ type Cloudbrain struct { | |||
| VersionName string `xorm:"INDEX"` | |||
| Uuid string | |||
| DatasetName string | |||
| VersionCount int64 `xorm:"INDEX DEFAULT 1"` | |||
| VersionCount int `xorm:"INDEX DEFAULT 1"` | |||
| IsLatestVersion string | |||
| CommitID string | |||
| FatherVersionName string | |||
| @@ -971,7 +971,7 @@ func Cloudbrains(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
| return cloudbrains, count, nil | |||
| } | |||
| func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, error) { | |||
| func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int, error) { | |||
| sess := x.NewSession() | |||
| defer sess.Close() | |||
| @@ -1034,7 +1034,7 @@ func CloudbrainsVersionList(opts *CloudbrainsOptions) ([]*CloudbrainInfo, int64, | |||
| } | |||
| sess.Close() | |||
| return cloudbrains, count, nil | |||
| return cloudbrains, int(count), nil | |||
| } | |||
| func CreateCloudbrain(cloudbrain *Cloudbrain) (err error) { | |||
| @@ -1110,7 +1110,7 @@ func SetTrainJobStatusByJobID(jobID string, status string, duration int64, train | |||
| return | |||
| } | |||
| func SetVersionCountAndLatestVersionByJobIDAndVersionName(jobID string, versionName string, versionCount int64, isLatestVersion string) (err error) { | |||
| func SetVersionCountAndLatestVersionByJobIDAndVersionName(jobID string, versionName string, versionCount int, isLatestVersion string) (err error) { | |||
| cb := &Cloudbrain{JobID: jobID, VersionName: versionName, VersionCount: versionCount, IsLatestVersion: isLatestVersion} | |||
| _, err = x.Cols("version_Count", "is_latest_version").Where("cloudbrain.job_id=? AND cloudbrain.version_name=?", jobID, versionName).Update(cb) | |||
| return | |||
| @@ -49,6 +49,7 @@ const ( | |||
| NotLatestVersion = "0" | |||
| ComputeResource = "NPU" | |||
| InitFatherVersionName = "V0001" | |||
| VersionCount = 1 | |||
| SortByCreateTime = "create_time" | |||
| ConfigTypeCustom = "custom" | |||
| @@ -65,6 +66,7 @@ type GenerateTrainJobReq struct { | |||
| Description string | |||
| CodeObsPath string | |||
| BootFile string | |||
| BootFileUrl string | |||
| DataUrl string | |||
| TrainUrl string | |||
| FlavorCode string | |||
| @@ -79,6 +81,7 @@ type GenerateTrainJobReq struct { | |||
| BranchName string | |||
| FatherVersionName string | |||
| FlavorName string | |||
| VersionCount int | |||
| } | |||
| type GenerateTrainJobVersionReq struct { | |||
| @@ -87,6 +90,7 @@ type GenerateTrainJobVersionReq struct { | |||
| Description string | |||
| CodeObsPath string | |||
| BootFile string | |||
| BootFileUrl string | |||
| DataUrl string | |||
| TrainUrl string | |||
| FlavorCode string | |||
| @@ -208,7 +212,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||
| Config: models.Config{ | |||
| WorkServerNum: req.WorkServerNumber, | |||
| AppUrl: req.CodeObsPath, | |||
| BootFileUrl: req.BootFile, | |||
| BootFileUrl: req.BootFileUrl, | |||
| DataUrl: req.DataUrl, | |||
| EngineID: req.EngineID, | |||
| TrainUrl: req.TrainUrl, | |||
| @@ -259,6 +263,7 @@ func GenerateTrainJob(ctx *context.Context, req *GenerateTrainJobReq) (err error | |||
| Description: req.Description, | |||
| WorkServerNumber: req.WorkServerNumber, | |||
| FlavorName: req.FlavorName, | |||
| VersionCount: req.VersionCount, | |||
| }) | |||
| if err != nil { | |||
| @@ -275,7 +280,7 @@ func GenerateTrainJobVersion(ctx *context.Context, req *GenerateTrainJobVersionR | |||
| Config: models.TrainJobVersionConfig{ | |||
| WorkServerNum: req.WorkServerNumber, | |||
| AppUrl: req.CodeObsPath, | |||
| BootFileUrl: req.BootFile, | |||
| BootFileUrl: req.BootFileUrl, | |||
| DataUrl: req.DataUrl, | |||
| EngineID: req.EngineID, | |||
| TrainUrl: req.TrainUrl, | |||
| @@ -715,6 +715,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||
| branch_name := form.BranchName | |||
| isLatestVersion := modelarts.IsLatestVersion | |||
| FlavorName := form.FlavorName | |||
| VersionCount := modelarts.VersionCount | |||
| if err := paramCheckCreateTrainJob(form); err != nil { | |||
| log.Error("paramCheckCreateTrainJob failed:(%v)", err) | |||
| @@ -847,7 +848,8 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||
| DataUrl: dataPath, | |||
| Description: description, | |||
| CodeObsPath: codeObsPath, | |||
| BootFile: codeObsPath + bootFile, | |||
| BootFileUrl: codeObsPath + bootFile, | |||
| BootFile: bootFile, | |||
| TrainUrl: outputObsPath, | |||
| FlavorCode: flavorCode, | |||
| WorkServerNumber: workServerNumber, | |||
| @@ -862,6 +864,7 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||
| Params: form.Params, | |||
| FatherVersionName: modelarts.InitFatherVersionName, | |||
| FlavorName: FlavorName, | |||
| VersionCount: VersionCount, | |||
| } | |||
| err = modelarts.GenerateTrainJob(ctx, req) | |||
| @@ -910,9 +913,6 @@ func TrainJobCreate(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) | |||
| func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJobForm) { | |||
| ctx.Data["PageIsTrainJob"] = true | |||
| var jobID = ctx.Params(":jobid") | |||
| // var fatherVersionName = ctx.Query("versionName") | |||
| // jobID = "19373" | |||
| // versionName = "V0009" | |||
| jobName := form.JobName | |||
| uuid := form.Attachment | |||
| @@ -1070,7 +1070,8 @@ func TrainJobCreateVersion(ctx *context.Context, form auth.CreateModelArtsTrainJ | |||
| DataUrl: dataPath, | |||
| Description: description, | |||
| CodeObsPath: codeObsPath, | |||
| BootFile: codeObsPath + bootFile, | |||
| BootFileUrl: codeObsPath + bootFile, | |||
| BootFile: bootFile, | |||
| TrainUrl: outputObsPath, | |||
| FlavorCode: flavorCode, | |||
| WorkServerNumber: workServerNumber, | |||