diff --git a/go.sum b/go.sum index 6735a1938..e0c11f261 100755 --- a/go.sum +++ b/go.sum @@ -713,12 +713,14 @@ github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1 github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w= github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM= +github.com/smartystreets/assertions v1.1.0 h1:MkTeG1DMwsrdH7QtLXy5W+fUxWq+vmb6cLmyJ7aRtF0= github.com/smartystreets/assertions v1.1.0/go.mod h1:tcbTF8ujkAEcZ8TElKY+i30BzYlVhC/LOxJk7iOWnoo= github.com/smartystreets/go-aws-auth v0.0.0-20180515143844-0c1422d1fdb9/go.mod h1:SnhjPscd9TpLiy1LpzGSKh3bXCfxxXuqd9xmQJy3slM= github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s= github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8= github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= +github.com/smartystreets/goconvey v1.6.4 h1:fv0U8FUIMPNf1L9lnHLvLhgicrIVChEkdzIKYqbNC9s= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= github.com/sourcegraph/annotate v0.0.0-20160123013949-f4cad6c6324d/go.mod h1:UdhH50NIW0fCiwBSr0co2m7BnFLdv4fQTgdqdJTHFeE= diff --git a/models/dataset.go b/models/dataset.go index 7f049f068..a0f6ba2aa 100755 --- a/models/dataset.go +++ b/models/dataset.go @@ -88,7 +88,7 @@ func (datasets DatasetList) loadAttributes(e Engine) error { if err := e. Where("id > 0"). In("id", keysInt64(set)). - Cols("id", "owner_id", "owner_name", "lower_name", "name", "description", "alias", "lower_alias","is_private"). + Cols("id", "owner_id", "owner_name", "lower_name", "name", "description", "alias", "lower_alias", "is_private"). Find(&repos); err != nil { return fmt.Errorf("find repos: %v", err) } @@ -121,12 +121,12 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) if attachment.DatasetID == datasets[i].ID { if opts.StarByMe { - permission,ok := permissionMap[datasets[i].ID]; + permission, ok := permissionMap[datasets[i].ID] if !ok { permission = false datasets[i].Repo.GetOwner() - if datasets[i].Repo.Owner.IsOrganization() { + if datasets[i].Repo.Owner.IsOrganization() { if datasets[i].Repo.Owner.IsUserPartOfOrg(opts.User.ID) { log.Info("user is member of org.") permission = true @@ -140,10 +140,10 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) } } - permissionMap[datasets[i].ID]=permission + permissionMap[datasets[i].ID] = permission } - if permission{ + if permission { datasets[i].Attachments = append(datasets[i].Attachments, attachment) } else if !attachment.IsPrivate { datasets[i].Attachments = append(datasets[i].Attachments, attachment) @@ -159,8 +159,8 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) } for i := range datasets { - if datasets[i].Attachments==nil{ - datasets[i].Attachments=[]*Attachment{} + if datasets[i].Attachments == nil { + datasets[i].Attachments = []*Attachment{} } datasets[i].Repo.Owner = nil } @@ -585,3 +585,13 @@ func GetTeamDatasetIdsByUserID(userID int64) []int64 { Cols("dataset.id").Find(&datasets) return datasets } + +func UpdateDatasetCreateUser(ID int64, user *User) error { + _, err := x.Where("id = ?", ID).Cols("user_id").Update(&Dataset{ + UserID: user.ID, + }) + if err != nil { + return err + } + return nil +} diff --git a/modules/cloudbrain/resty.go b/modules/cloudbrain/resty.go index a7a19ed10..d9db3bbb5 100755 --- a/modules/cloudbrain/resty.go +++ b/modules/cloudbrain/resty.go @@ -24,10 +24,11 @@ var ( ) const ( - JobHasBeenStopped = "S410" - Public = "public" - Custom = "custom" - LogPageSize = 500 + JobHasBeenStopped = "S410" + errInvalidToken = "S401" + Public = "public" + Custom = "custom" + LogPageSize = 500 LogPageTokenExpired = "5m" pageSize = 15 QueuesDetailUrl = "/rest-server/api/v2/queuesdetail" @@ -59,7 +60,7 @@ func loginCloudbrain() error { res, err := client.R(). SetHeader("Content-Type", "application/json"). - SetBody(map[string]interface{}{"username": username, "password": password, "expiration": "604800"}). + SetBody(map[string]interface{}{"username": username, "password": password, "expiration": conf.Expiration}). SetResult(&loginResult). Post(HOST + "/rest-server/api/v1/token") if err != nil { @@ -122,16 +123,12 @@ sendjob: Post(HOST + "/rest-server/api/v1/jobs/") if err != nil { - if res != nil { - var response models.CloudBrainResult - json.Unmarshal(res.Body(), &response) - log.Error("code(%s), msg(%s)", response.Code, response.Msg) - return nil, fmt.Errorf(response.Msg) - } return nil, fmt.Errorf("resty create job: %s", err) } - if jobResult.Code == "S401" && retry < 1 { + var response models.CloudBrainResult + json.Unmarshal(res.Body(), &response) + if response.Code == errInvalidToken && retry < 1 { retry++ _ = loginCloudbrain() goto sendjob @@ -163,7 +160,9 @@ sendjob: return nil, fmt.Errorf("resty GetJob: %v", err) } - if getJobResult.Code == "S401" && retry < 1 { + var response models.CloudBrainResult + json.Unmarshal(res.Body(), &response) + if response.Code == errInvalidToken && retry < 1 { retry++ _ = loginCloudbrain() goto sendjob @@ -196,13 +195,8 @@ sendjob: } var response models.CloudBrainResult - err = json.Unmarshal(res.Body(), &response) - if err != nil { - log.Error("json.Unmarshal failed: %s", err.Error()) - return &getImagesResult, fmt.Errorf("json.Unmarshal failed: %s", err.Error()) - } - - if response.Code == "S401" && retry < 1 { + json.Unmarshal(res.Body(), &response) + if response.Code == errInvalidToken && retry < 1 { retry++ _ = loginCloudbrain() goto sendjob @@ -290,7 +284,9 @@ sendjob: return fmt.Errorf("resty CommitImage: %v", err) } - if result.Code == "S401" && retry < 1 { + var response models.CloudBrainResult + json.Unmarshal(res.Body(), &response) + if response.Code == errInvalidToken && retry < 1 { retry++ _ = loginCloudbrain() goto sendjob @@ -442,7 +438,9 @@ sendjob: return fmt.Errorf("resty StopJob: %v", err) } - if result.Code == "S401" && retry < 1 { + var response models.CloudBrainResult + json.Unmarshal(res.Body(), &response) + if response.Code == errInvalidToken && retry < 1 { retry++ _ = loginCloudbrain() goto sendjob @@ -498,7 +496,7 @@ func GetJobAllLog(scrollID string) (*models.GetJobLogResult, error) { client := getRestyClient() var result models.GetJobLogResult req := models.GetAllJobLogParams{ - Scroll: LogPageTokenExpired, + Scroll: LogPageTokenExpired, ScrollID: scrollID, } @@ -522,7 +520,7 @@ func GetJobAllLog(scrollID string) (*models.GetJobLogResult, error) { return &result, nil } -func DeleteJobLogToken(scrollID string) (error) { +func DeleteJobLogToken(scrollID string) error { checkSetting() client := getRestyClient() var result models.DeleteJobLogTokenResult diff --git a/modules/setting/cloudbrain.go b/modules/setting/cloudbrain.go index 2d80eea25..c06676243 100755 --- a/modules/setting/cloudbrain.go +++ b/modules/setting/cloudbrain.go @@ -5,6 +5,7 @@ type CloudbrainLoginConfig struct { Password string Host string ImageURLPrefix string + Expiration string } var ( @@ -17,5 +18,6 @@ func GetCloudbrainConfig() CloudbrainLoginConfig { Cloudbrain.Password = cloudbrainSec.Key("PASSWORD").MustString("") Cloudbrain.Host = cloudbrainSec.Key("REST_SERVER_HOST").MustString("") Cloudbrain.ImageURLPrefix = cloudbrainSec.Key("IMAGE_URL_PREFIX").MustString("") + Cloudbrain.Expiration = cloudbrainSec.Key("EXPIRATION").MustString("604800") return Cloudbrain } diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 90d0348bb..3c1237820 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -253,13 +253,15 @@ page_dev_env_desc2_desc=Associate the model with the code version, you can adjus page_dev_env_desc3_title=Once Configuration, Multiple Reuse page_dev_env_desc3_desc=Provide execution environment sharing, Once Configuration, Multiple Reuse. Lower the threshold of model development, and avoid spending repetitive time configuring complex environments. page_dev_yunlao=OpenI AI Collaboration Platform -page_dev_yunlao_desc1=OpenI AI collaboration platform has cooperated with Pengcheng cloud brain and China computing power network (c ² Net) can be used to complete AI development tasks by using the rich computing resources of Pengcheng cloud brain and China computing network. +page_dev_yunlao_desc1=OpenI AI collaboration platform has cooperated with Pengcheng cloud brain and China computing power network (C²NET) can be used to complete AI development tasks by using the rich computing resources of Pengcheng cloud brain and China computing network. page_dev_yunlao_desc2=Pengcheng CloudBrain's existing AI computing power is 100p FLOPS@FP16 (billions of half precision floating-point calculations per second), the main hardware infrastructure consists of GPU servers equipped with NVIDIA Tesla V100 and A100, and Atlas 900 AI clusters equipped with Kunpeng and shengteng processors. -page_dev_yunlao_desc3=China computing power network (c ² Net) phase I can realize high-speed network interconnection between different artificial intelligence computing centers, and realize reasonable scheduling of computing power and flexible allocation of resources. At present, 11 intelligent computing centers have been connected, and the total scale of computing power is 1924p OPS@FP16 。 Qizhi AI collaboration platform has been connected to Pengcheng Cloud Computing Institute, Chengdu Intelligent Computing Center, Zhongyuan Intelligent Computing Center, Hefei brain and other nodes. +page_dev_yunlao_desc3=China computing power network (C²NET) phase I can realize high-speed network interconnection between different artificial intelligence computing centers, and realize reasonable scheduling of computing power and flexible allocation of resources. At present, 11 intelligent computing centers have been connected, and the total scale of computing power is 1924p OPS@FP16. OpenI AI collaboration platform has been connected to Pengcheng Cloud Computing Institute, Chengdu Intelligent Computing Center, Zhongyuan Intelligent Computing Center, Hefei brain and other nodes. page_dev_yunlao_desc4=Developers can freely select the corresponding computing resources according to the use needs, and can test the adaptability, performance, stability, etc. of the model in different hardware environments. page_dev_yunlao_desc5=If your model requires more computing resources, you can also apply for it separately. page_dev_yunlao_apply=Apply Separately - +c2net_title=China Computing Network +c2net_desc=The artificial intelligence computing power network promotion alliance has access to 11 intelligent computing centers, with a total scale of 1924p. +c2net_center=Center search=Search search_repo=Repository search_dataset=DataSet @@ -822,6 +824,8 @@ title_format_err=Name can only contain number,letter,'-','_' or '.', and can be description = Description description_format_err=Description's length can be up to %s characters long. create_dataset = Create Dataset +download_url=Download Url +download_oper=Operation create_dataset_fail=Failed to create dataset. query_dataset_fail=Failed to query dataset. edit_attachment_fail=Failed to update description. @@ -3094,7 +3098,7 @@ resource_cluster = Resource Cluster resource_cluster_openi = OpenI Resource Cluster resource_cluster_c2net = China Computing NET resource_cluster_openi_simple = OpenI -resource_cluster_c2net_simple = Computing NET +resource_cluster_c2net_simple = C²NET compute_resource = Computing resources task_name = Task name task_type = Task type @@ -3119,7 +3123,8 @@ wrong_specification=You cannot use this specification, please choose another ite job_name_rule = Please enter letters, numbers, _ and - up to 64 characters and cannot end with a dash (-). -dataset_path_rule = The dataset location is stored in the environment variable data_url, and the output path is stored in the environment variable train_url. +train_dataset_path_rule = The dataset location is stored in the environment variable data_url, and the output path is stored in the environment variable train_url. +infer_dataset_path_rule = The dataset location is stored in the environment variable data_url, and the output path is stored in the environment variable train_url. view_sample = View sample inference_output_path_rule = The inference output path is stored in the environment variable result_url. model_file_path_rule=The model file location is stored in the environment variable ckpt_url diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 4c38aefcc..06a1f3639 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -261,7 +261,9 @@ page_dev_yunlao_desc3=中国算力网(C²NET)一期可实现不同人工智 page_dev_yunlao_desc4=开发者可以根据使用需求,自由选择相应计算资源,可以测试模型在不同硬件环境下的适配能力、性能、稳定性等。 page_dev_yunlao_desc5=如果您的模型需要更多的计算资源,也可以单独申请。 page_dev_yunlao_apply=单独申请 - +c2net_title=智算网络 +c2net_desc=人工智能算力网络推进联盟已接入11家智算中心,算力总规模1924P +c2net_center=中心 search=搜索 search_repo=项目 search_dataset=数据集 @@ -830,7 +832,8 @@ create_dataset=创建数据集 create_dataset_fail=创建数据集失败。 query_dataset_fail=查询数据集失败。 edit_attachment_fail=修改描述失败。 - +download_url=数据集下载地址 +download_oper=操作 show_dataset=数据集 edit_dataset=编辑数据集 update_dataset=更新数据集 @@ -3134,7 +3137,8 @@ card_type = 卡类型 wrong_specification=您目前不能使用这个资源规格,请选择其他资源规格。 job_name_rule = 请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。 -dataset_path_rule = 数据集位置存储在环境变量data_url中,输出路径存储在环境变量train_url中。 +train_dataset_path_rule = 数据集位置存储在环境变量data_url中,训练输出路径存储在环境变量train_url中。 +infer_dataset_path_rule = 数据集位置存储在环境变量data_url中,推理输出路径存储在环境变量train_url中。 view_sample = 查看样例 inference_output_path_rule = 推理输出路径存储在环境变量result_url中。 model_file_path_rule = 模型文件位置存储在环境变量ckpt_url中。 diff --git a/routers/api/v1/repo/cloudbrain.go b/routers/api/v1/repo/cloudbrain.go index a8c5762e4..b450b2e26 100755 --- a/routers/api/v1/repo/cloudbrain.go +++ b/routers/api/v1/repo/cloudbrain.go @@ -378,6 +378,7 @@ func CloudbrainDownloadLogFile(ctx *context.Context) { ctx.ServerError(err.Error(), err) return } + prefix := "/" + setting.CBCodePathPrefix + job.JobName + "/model" files, err := storage.GetOneLevelAllObjectUnderDirMinio(setting.Attachment.Minio.Bucket, prefix, "") if err != nil { @@ -398,7 +399,7 @@ func CloudbrainDownloadLogFile(ctx *context.Context) { ctx.ServerError("Get minio get SignedUrl failed", err) return } - http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) + http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusTemporaryRedirect) } } diff --git a/routers/api/v1/repo/modelarts.go b/routers/api/v1/repo/modelarts.go index 419c6d6a4..79e35812e 100755 --- a/routers/api/v1/repo/modelarts.go +++ b/routers/api/v1/repo/modelarts.go @@ -6,13 +6,14 @@ package repo import ( - "code.gitea.io/gitea/modules/notification" "encoding/json" "net/http" "path" "strconv" "strings" + "code.gitea.io/gitea/modules/notification" + "code.gitea.io/gitea/modules/grampus" "code.gitea.io/gitea/modules/setting" @@ -352,6 +353,14 @@ func DelTrainJobVersion(ctx *context.APIContext) { return } + if task.Status != string(models.ModelArtsTrainJobImageFailed) && task.Status != string(models.ModelArtsTrainJobSubmitFailed) && task.Status != string(models.ModelArtsTrainJobDeleteFailed) && + task.Status != string(models.ModelArtsTrainJobCompleted) && task.Status != string(models.ModelArtsTrainJobFailed) && + task.Status != string(models.ModelArtsTrainJobKilled) && task.Status != string(models.ModelArtsTrainJobCanceled) && task.Status != string(models.ModelArtsTrainJobLost) { + log.Error("the job(%s) version has not been stopped", task.JobName) + ctx.NotFound(err) + return + } + //删除modelarts上的记录 _, err = modelarts.DelTrainJobVersion(jobID, strconv.FormatInt(task.VersionID, 10)) if err != nil { diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 697e6591e..25c394efc 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -502,9 +502,11 @@ func NotebookRestart(ctx *context.Context) { break } + id = strconv.FormatInt(newTask.ID, 10) + status = res.Status resultCode = "0" - notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, strconv.FormatInt(newTask.ID, 10), newTask.DisplayJobName, models.ActionCreateDebugNPUTask) + notification.NotifyOtherTask(ctx.User, ctx.Repo.Repository, id, newTask.DisplayJobName, models.ActionCreateDebugNPUTask) break } @@ -1843,6 +1845,16 @@ func TrainJobDel(ctx *context.Context) { return } + for _, task := range VersionListTasks { + if task.Status != string(models.ModelArtsTrainJobImageFailed) && task.Status != string(models.ModelArtsTrainJobSubmitFailed) && task.Status != string(models.ModelArtsTrainJobDeleteFailed) && + task.Status != string(models.ModelArtsTrainJobCompleted) && task.Status != string(models.ModelArtsTrainJobFailed) && + task.Status != string(models.ModelArtsTrainJobKilled) && task.Status != string(models.ModelArtsTrainJobCanceled) && task.Status != string(models.ModelArtsTrainJobLost) { + log.Error("the job(%s) version has not been stopped", task.JobName) + ctx.RenderWithErr("the job version has not been stopped", tplModelArtsTrainJobIndex, nil) + return + } + } + //删除modelarts上的任务记录 _, err = modelarts.DelTrainJob(jobID) if err != nil { diff --git a/routers/repo/setting.go b/routers/repo/setting.go index 3b9282ae9..11efdf275 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -464,6 +464,16 @@ func SettingsPost(ctx *context.Context, form auth.RepoSettingForm) { } return } + dataset, err := models.GetDatasetByRepo(repo) + if err == nil { + if dataset != nil { + models.UpdateDatasetCreateUser(dataset.ID, newOwner) + } else { + log.Info("not found the dataset") + } + } else { + log.Info("error=" + err.Error()) + } log.Trace("Repository transferred: %s/%s -> %s", ctx.Repo.Owner.Name, repo.Name, newOwner) ctx.Flash.Success(ctx.Tr("repo.settings.transfer_succeed")) diff --git a/templates/custom/wait_count.tmpl b/templates/custom/wait_count.tmpl index bef8f1327..072d1d40d 100644 --- a/templates/custom/wait_count.tmpl +++ b/templates/custom/wait_count.tmpl @@ -13,9 +13,9 @@ {{ end }} - {{.i18n.Tr "repo.wait_count_start"}} {{if .QueuesDetail}} {{ $gpuQueue }} diff --git a/templates/custom/wait_count_train.tmpl b/templates/custom/wait_count_train.tmpl index fcfadc5be..4b7e2dac3 100644 --- a/templates/custom/wait_count_train.tmpl +++ b/templates/custom/wait_count_train.tmpl @@ -14,9 +14,9 @@ {{ end }} - {{.ctx.i18n.Tr "repo.wait_count_start"}} {{if .type}} {{ $gpuQueue }} diff --git a/templates/home.tmpl b/templates/home.tmpl index 8de647d75..c7485a214 100755 --- a/templates/home.tmpl +++ b/templates/home.tmpl @@ -89,8 +89,8 @@
-

智算网络

-

人工智能算力网络推进联盟已接入11家智算中心,算力总规模1924P

+

{{.i18n.Tr "home.c2net_title"}}

+

{{.i18n.Tr "home.c2net_desc"}}

@@ -98,7 +98,7 @@
- +
diff --git a/templates/repo/cloudbrain/inference/show.tmpl b/templates/repo/cloudbrain/inference/show.tmpl index 97a0b4936..848ccfc20 100644 --- a/templates/repo/cloudbrain/inference/show.tmpl +++ b/templates/repo/cloudbrain/inference/show.tmpl @@ -495,7 +495,7 @@
- + {{range $m ,$n := $.datasetDownload}} diff --git a/templates/repo/cloudbrain/show.tmpl b/templates/repo/cloudbrain/show.tmpl index ccd8e2835..bdde80772 100755 --- a/templates/repo/cloudbrain/show.tmpl +++ b/templates/repo/cloudbrain/show.tmpl @@ -493,7 +493,7 @@
数据集文件
{{$.i18n.Tr "dataset.file"}}
- + {{range $m ,$n := $.datasetDownload}} diff --git a/templates/repo/cloudbrain/trainjob/show.tmpl b/templates/repo/cloudbrain/trainjob/show.tmpl index 9d110e8fd..ba299a7eb 100644 --- a/templates/repo/cloudbrain/trainjob/show.tmpl +++ b/templates/repo/cloudbrain/trainjob/show.tmpl @@ -459,7 +459,7 @@
数据集文件
{{$.i18n.Tr "dataset.file"}}
- + {{range $m ,$n := $.datasetDownload}} @@ -499,7 +499,7 @@
+ href="/api/v1/repos/{{$.RepoRelPath}}/cloudbrain/{{.ID}}/download_log_file"> {{$.i18n.Tr "repo.modelarts.download_log"}} diff --git a/templates/repo/modelarts/inferencejob/new.tmpl b/templates/repo/modelarts/inferencejob/new.tmpl index cacac8dc9..e427a3703 100644 --- a/templates/repo/modelarts/inferencejob/new.tmpl +++ b/templates/repo/modelarts/inferencejob/new.tmpl @@ -86,7 +86,7 @@ {{template "custom/wait_count_train" Dict "ctx" $}}
- {{.i18n.Tr "cloudbrain.dataset_path_rule" | Safe}} + {{.i18n.Tr "cloudbrain.infer_dataset_path_rule" | Safe}}
diff --git a/templates/repo/modelarts/inferencejob/show.tmpl b/templates/repo/modelarts/inferencejob/show.tmpl index 628615879..50022374c 100644 --- a/templates/repo/modelarts/inferencejob/show.tmpl +++ b/templates/repo/modelarts/inferencejob/show.tmpl @@ -436,7 +436,7 @@ td, th {
数据集文件
{{$.i18n.Tr "dataset.file"}}
- + {{range $m ,$n := $.datasetDownload}} diff --git a/templates/repo/modelarts/notebook/show.tmpl b/templates/repo/modelarts/notebook/show.tmpl index 91eba9932..65cfb68d9 100755 --- a/templates/repo/modelarts/notebook/show.tmpl +++ b/templates/repo/modelarts/notebook/show.tmpl @@ -432,16 +432,16 @@
数据集文件
{{$.i18n.Tr "dataset.file"}}
- - - + + + {{range $.datasetDownload}} - + {{end}} diff --git a/templates/repo/modelarts/trainjob/new.tmpl b/templates/repo/modelarts/trainjob/new.tmpl index 20c45fae5..3a9bd9dba 100755 --- a/templates/repo/modelarts/trainjob/new.tmpl +++ b/templates/repo/modelarts/trainjob/new.tmpl @@ -113,7 +113,7 @@ {{template "custom/wait_count_train" Dict "ctx" $}}
- {{.i18n.Tr "cloudbrain.dataset_path_rule" | Safe}} + {{.i18n.Tr "cloudbrain.train_dataset_path_rule" | Safe}}
diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index e780b679f..71a39424f 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -274,10 +274,14 @@ {{if .CanDel}} - {{$.i18n.Tr "repo.delete"}} {{else}} - {{$.i18n.Tr "repo.delete"}} {{end}}
@@ -478,7 +482,7 @@
数据集文件数据集下载地址操作
{{$.i18n.Tr "dataset.file"}}{{$.i18n.Tr "dataset.download_url"}}{{$.i18n.Tr "dataset.download_oper"}}
{{.DatasetName}} {{.DatasetDownloadLink}}复制链接复制链接
- + {{range $m ,$n := $.datasetList}} @@ -899,35 +903,7 @@ $('#name').val(modelName) $('#version').val("0.0.1") } - function deleteVersion(version_name) { - stopBubbling(arguments.callee.caller.arguments[0]) - let flag = 1; - $('.ui.basic.modal').modal({ - onDeny: function () { - flag = false - }, - onApprove: function () { - $.post(`/api/v1/repos/${userName}/${repoPath}/modelarts/train-job/${jobID}/del_version`, { version_name: version_name }, (data) => { - if (data.VersionListCount === 0) { - location.href = `/${userName}/${repoPath}/modelarts/train-job` - } else { - $('#accordion' + version_name).remove() - } - - }).fail(function (err) { - console.log(err); - }); - flag = true - }, - onHidden: function () { - if (flag == false) { - $('.alert').html('您已取消操作').removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut(); - } - } - }) - .modal('show') - - } + diff --git a/templates/repo/modelarts/trainjob/version_new.tmpl b/templates/repo/modelarts/trainjob/version_new.tmpl index cf32409ed..b9d24ba7a 100644 --- a/templates/repo/modelarts/trainjob/version_new.tmpl +++ b/templates/repo/modelarts/trainjob/version_new.tmpl @@ -73,6 +73,11 @@ + {{template "custom/wait_count_train" Dict "ctx" $}} +
+ + {{.i18n.Tr "cloudbrain.train_dataset_path_rule" | Safe}} +

{{.i18n.Tr "repo.modelarts.train_job.basic_info"}}:

@@ -152,26 +157,10 @@ {{.i18n.Tr "cloudbrain.view_sample"}}
- -
- {{.i18n.Tr "cloudbrain.dataset_path_rule"}} +
{{.i18n.Tr "repo.modelarts.train_job.add_run_parameter"}} diff --git a/web_src/js/features/cloudbrainShow.js b/web_src/js/features/cloudbrainShow.js index 691ac57c4..73a8ed7b6 100644 --- a/web_src/js/features/cloudbrainShow.js +++ b/web_src/js/features/cloudbrainShow.js @@ -213,6 +213,35 @@ export default async function initCloudrainSow() { }); e.stopPropagation(); }); + $(".delete-show-version").click(function (e) { + const ID = this.dataset.jobid; + const repoPath = this.dataset.repopath; + const version_name = this.dataset.version; + const url = `/api/v1/repos/${repoPath}/${ID}/del_version`; + $(".ui.basic.modal") + .modal({ + onApprove: function () { + $.post(url, { version_name: version_name }, (data) => { + console.log(data); + if (data.StatusOK === 0) { + if (data.VersionListCount === 0) { + location.href = `/${repoPath}`; + } else { + $("#accordion" + version_name).remove(); + } + refreshStatusShow(version_name, ID, repoPath); + } else { + return; + } + }).fail(function (err) { + console.log(err); + }); + }, + }) + .modal("show"); + + e.stopPropagation(); + }); function refreshStatusShow(version_name, ID, repoPath) { $.get( `/api/v1/repos/${repoPath}/${ID}?version_name=${version_name}`, @@ -390,7 +419,7 @@ export default async function initCloudrainSow() { html += ""; html += ""; html += ""; - html += "
数据集文件
{{$.i18n.Tr "dataset.file"}}
"; + html += ""; if (data.Dirs[i].IsDir) { html += ""; } else { diff --git a/web_src/js/features/cloudrbanin.js b/web_src/js/features/cloudrbanin.js index 445f70be3..2df780233 100644 --- a/web_src/js/features/cloudrbanin.js +++ b/web_src/js/features/cloudrbanin.js @@ -182,6 +182,15 @@ export default async function initCloudrain() { "CREATE_FAILED", "STOPPED", ]; + let deleteArray = [ + "KILLED", + "FAILED", + "START_FAILED", + "COMPLETED", + "SUCCEEDED", + "CREATE_FAILED", + "STOPPED", + ]; $.get( `/api/v1/repos/${repoPath}/${jobID}?version_name=${versionname}`, (data) => { @@ -194,6 +203,10 @@ export default async function initCloudrain() { if (stopArray.includes(data.JobStatus)) { $("#" + versionname + "-stop").addClass("disabled"); } + if (deleteArray.includes(data.JobStatus)) { + $(`#${versionname}-delete`).removeClass("disabled"); + $(`#${versionname}-delete`).addClass("blue"); + } if (data.JobStatus === "COMPLETED") { $("#" + versionname + "-create-model") .removeClass("disabled") diff --git a/web_src/js/index.js b/web_src/js/index.js index 1ec155461..738a31c7d 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -3520,7 +3520,7 @@ function initVueComponents() { `${self.reposFilter}:${self.archivedFilter}:${self.privateFilter}`, count ); - self.finalPage = Math.floor(count / self.searchLimit) + 1; + self.finalPage = Math.ceil(count / self.searchLimit); self.updateHistory(); } }).always(() => {