From 01e6dfe201950b453261a40f7fd215adaf634c0a Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Wed, 29 Dec 2021 11:38:58 +0800 Subject: [PATCH 1/9] no need to wait error --- modules/storage/minio.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/modules/storage/minio.go b/modules/storage/minio.go index c6f704df5..7b914817d 100755 --- a/modules/storage/minio.go +++ b/modules/storage/minio.go @@ -95,9 +95,7 @@ func (m *MinioStorage) DeleteDir(dir string) error { } }() - for rErr := range m.client.RemoveObjects(m.bucket, objectsCh) { - log.Error("Error detected during deletion: ", rErr) - } + m.client.RemoveObjects(m.bucket, objectsCh) return nil } From 4e4e6d150c9143ca989e3d15c4369088c2995a37 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 29 Dec 2021 14:44:20 +0800 Subject: [PATCH 2/9] fix issue --- web_src/less/openi.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/openi.less b/web_src/less/openi.less index dcde874be..2c92a5f8d 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -232,7 +232,7 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} .i-bg-used{background-position: -514px -52px;} .icon-bind{background-position: -550px -52px;} .icon-unbind{background-position: -568px -52px;} -.CREATING, .STOPPING, .DELETING, .STARTING, .WAITING ,.INIT,.KILLING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} +.CREATING, .STOPPING, .DELETING, .STARTING, i .WAITING ,.INIT,.KILLING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} .COMPLETED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -441px -52px;} .text_over{ From 60776f0e9e489bbfb3cde33da36ee21c4bf7ee4c Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 29 Dec 2021 16:12:23 +0800 Subject: [PATCH 3/9] fix issue --- web_src/less/openi.less | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 2c92a5f8d..9109f75f0 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -232,7 +232,7 @@ footer .column{margin-bottom:0!important; padding-bottom:0!important;} .i-bg-used{background-position: -514px -52px;} .icon-bind{background-position: -550px -52px;} .icon-unbind{background-position: -568px -52px;} -.CREATING, .STOPPING, .DELETING, .STARTING, i .WAITING ,.INIT,.KILLING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} +.CREATING, .STOPPING, .DELETING, .STARTING, i.WAITING ,.INIT,.KILLING{display:inline-block;background-image:url('/img/loading.gif');background-repeat:no-repeat;width:16px;height:16px;background-size:16px 16px;margin-right:5px;} .COMPLETED{display:inline-block;width:18px;height:18px;background:url("/img/icons.svg");background-position: -496px -52px;background-position: -441px -52px;} .text_over{ From 8e94a039109f1150252ac322e04d6067ff56277c Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 30 Dec 2021 09:47:54 +0800 Subject: [PATCH 4/9] add log --- modules/context/repo.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/modules/context/repo.go b/modules/context/repo.go index de494c1bc..4da6e9a16 100755 --- a/modules/context/repo.go +++ b/modules/context/repo.go @@ -11,6 +11,7 @@ import ( "net/url" "path" "strings" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/cache" @@ -517,6 +518,7 @@ func RepoAssignment() macaron.Handler { return } + startTime := time.Now() tags, err := ctx.Repo.GitRepo.GetTags() if err != nil { ctx.ServerError("GetTags", err) @@ -524,11 +526,17 @@ func RepoAssignment() macaron.Handler { } ctx.Data["Tags"] = tags + duration := time.Since(startTime) + log.Info("GetTags cost: %v seconds", duration.Seconds()) brs, _, err := ctx.Repo.GitRepo.GetBranches(0, 0) if err != nil { ctx.ServerError("GetBranches", err) return } + + duration = time.Since(startTime) + log.Info("GetBranches cost: %v seconds", duration.Seconds()) + ctx.Data["Branches"] = brs ctx.Data["BranchesCount"] = len(brs) From ed5cfca0214583f587e4debcc5afe24e07459a43 Mon Sep 17 00:00:00 2001 From: lewis <747342561@qq.com> Date: Thu, 30 Dec 2021 14:10:33 +0800 Subject: [PATCH 5/9] debug log --- routers/repo/issue.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/repo/issue.go b/routers/repo/issue.go index 7ab5eb283..42a6b9609 100755 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -13,6 +13,7 @@ import ( "net/http" "strconv" "strings" + "time" "code.gitea.io/gitea/models" "code.gitea.io/gitea/modules/auth" @@ -336,6 +337,7 @@ func issues(ctx *context.Context, milestoneID int64, isPullOption util.OptionalB // Issues render issues page func Issues(ctx *context.Context) { + startTime := time.Now() isPullList := ctx.Params(":type") == "pulls" if isPullList { MustAllowPulls(ctx) @@ -366,6 +368,9 @@ func Issues(ctx *context.Context) { ctx.Data["CanWriteIssuesOrPulls"] = ctx.Repo.CanWriteIssuesOrPulls(isPullList) + duration := time.Since(startTime) + log.Info("Issues cost: %v seconds", duration.Seconds()) + ctx.HTML(200, tplIssues) } From 3d1854cf4ab286faec27a6348915661409b02899 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 30 Dec 2021 16:03:53 +0800 Subject: [PATCH 6/9] fix issue --- templates/repo/header.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/header.tmpl b/templates/repo/header.tmpl index 138a323e1..2091610df 100755 --- a/templates/repo/header.tmpl +++ b/templates/repo/header.tmpl @@ -51,7 +51,7 @@ {{if not .IsBeingCreated}}
-
+ {{$.CsrfTokenHtml}}
-
+ {{$.CsrfTokenHtml}}
- + From 570d815cb423b8b93ebad740ba181a6508467221 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Fri, 31 Dec 2021 18:21:43 +0800 Subject: [PATCH 7/9] fix issue --- templates/repo/debugjob/index.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/debugjob/index.tmpl b/templates/repo/debugjob/index.tmpl index bc8663eab..a50c35eda 100755 --- a/templates/repo/debugjob/index.tmpl +++ b/templates/repo/debugjob/index.tmpl @@ -331,7 +331,7 @@ {{end}} {{else}} - {{if eq .Status "RUNNING"}} + {{if eq .Status "RUNNING" "WAITING" "CREATING" "STARTING"}} {{$.i18n.Tr "repo.debug"}} From 6fba56c41842b6ab901945422fec9baa2817c903 Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 4 Jan 2022 10:09:10 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/ai_model_manage.go | 21 ++++++++++++++++++--- routers/routes/routes.go | 2 +- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/routers/repo/ai_model_manage.go b/routers/repo/ai_model_manage.go index 87c5dc001..845dbbc6b 100644 --- a/routers/repo/ai_model_manage.go +++ b/routers/repo/ai_model_manage.go @@ -99,6 +99,18 @@ func saveModelByParameters(jobId string, versionName string, name string, versio //udpate status and version count models.ModifyModelNewProperty(lastNewModelId, MODEL_NOT_LATEST, 0) } + var units []models.RepoUnit + var deleteUnitTypes []models.UnitType + units = append(units, models.RepoUnit{ + RepoID: ctx.Repo.Repository.ID, + Type: models.UnitTypeModelManage, + Config: &models.ModelManageConfig{ + EnableModelManage: true, + }, + }) + deleteUnitTypes = append(deleteUnitTypes, models.UnitTypeModelManage) + + models.UpdateRepositoryUnits(ctx.Repo.Repository, units, deleteUnitTypes) log.Info("save model end.") @@ -130,10 +142,13 @@ func SaveModel(ctx *context.Context) { version := ctx.Query("Version") label := ctx.Query("Label") description := ctx.Query("Description") + trainTaskCreate := ctx.QueryBool("trainTaskCreate") - if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { - ctx.ServerError("No right.", errors.New(ctx.Tr("repo.model_noright"))) - return + if !trainTaskCreate { + if !ctx.Repo.CanWrite(models.UnitTypeModelManage) { + ctx.ServerError("No right.", errors.New(ctx.Tr("repo.model_noright"))) + return + } } if JobId == "" || VersionName == "" { diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 85921b478..439c17a92 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -982,7 +982,7 @@ func RegisterRoutes(m *macaron.Macaron) { }, context.RepoRef()) m.Group("/modelmanage", func() { m.Post("/create_model", reqRepoModelManageWriter, repo.SaveModel) - m.Post("/create_new_model", reqRepoModelManageWriter, repo.SaveNewNameModel) + m.Post("/create_new_model", repo.SaveNewNameModel) m.Delete("/delete_model", repo.DeleteModel) m.Put("/modify_model", repo.ModifyModelInfo) m.Get("/show_model", reqRepoModelManageReader, repo.ShowModelTemplate) From 793a2be76a5d068e86e7515e0d056b9686eef512 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Tue, 4 Jan 2022 14:46:20 +0800 Subject: [PATCH 9/9] fix issue --- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 1 + templates/repo/modelarts/trainjob/show.tmpl | 127 +++++++++++++++++++- templates/repo/modelmanage/index.tmpl | 2 - 4 files changed, 128 insertions(+), 3 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 272957887..1dceb5c4a 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -844,6 +844,7 @@ modelarts.current_version=Current version modelarts.parent_version=Parent Version modelarts.run_version=Run Version modelarts.train_job.compute_node=Compute Node +modelarts.create_model = Create Model modelarts.train_job.basic_info=Basic Info diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index efa730002..2e7f4d73c 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -849,6 +849,7 @@ modelarts.modify=修改 modelarts.current_version=当前版本 modelarts.parent_version=父版本 modelarts.run_version=运行版本 +modelarts.create_model=创建模型 diff --git a/templates/repo/modelarts/trainjob/show.tmpl b/templates/repo/modelarts/trainjob/show.tmpl index 956853d94..0be93fc8f 100755 --- a/templates/repo/modelarts/trainjob/show.tmpl +++ b/templates/repo/modelarts/trainjob/show.tmpl @@ -161,6 +161,15 @@ td, th { padding-top: 0.5rem ; } +
+
+
+
+
+
+
+
+
{{template "repo/header" .}}
@@ -186,6 +195,12 @@ td, th {
+ {{$.CsrfTokenHtml}} + {{if .CanModify}} + {{$.i18n.Tr "repo.modelarts.create_model"}} + {{else}} + {{$.i18n.Tr "repo.modelarts.create_model"}} + {{end}} {{$.CsrfTokenHtml}} {{if .CanModify}} {{$.i18n.Tr "repo.modelarts.modify"}} @@ -446,6 +461,62 @@ td, th {
+ +
+
{{template "base/footer" .}} @@ -479,7 +550,61 @@ td, th { } let timeid = window.setInterval(loadJobStatus, 30000); $(document).ready(loadJobStatus); - + function showcreate(obj){ + $('.ui.modal.second') + .modal({ + centered: false, + onShow:function(){ + $('input[name="Version"]').addClass('model_disabled') + // $('input[name="JobId"]').text(obj.JobName) + $('#JobName').val(obj.JobName).addClass('model_disabled') + $('input[name="JobId"]').val(obj.JobID) + $('input[name="VersionName"]').val(obj.VersionName).addClass('model_disabled') + $('.ui.dimmer').css({"background-color":"rgb(136, 136, 136,0.7)"}) + createModelName() + + + }, + onHide:function(){ + document.getElementById("formId").reset(); + $('.ui.dimmer').css({"background-color":""}) + $('.ui.error.message').text() + $('.ui.error.message').css('display','none') + + } + }) + .modal('show') + } + function createModel(){ + let url_href = `/${userName}/${repoPath}/modelmanage/create_new_model` + let data = $("#formId").serialize() + $("#mask").css({"display":"block","z-index":"9999"}) + $.ajax({ + url:url_href, + type:'POST', + data:data, + success:function(res){ + location.href=`/${userName}/${repoPath}/modelmanage/show_model` + $('.ui.modal.second').modal('hide') + }, + error: function(xhr){ + // 隐藏 loading + // 只有请求不正常(状态码不为200)才会执行 + $('.ui.error.message').text(xhr.responseText) + $('.ui.error.message').css('display','block') + }, + complete:function(xhr){ + $("#mask").css({"display":"none","z-index":"1"}) + } + }) + + } + function createModelName(){ + let repoName = location.pathname.split('/')[2] + let modelName = repoName + '_model_' + Math.random().toString(36).substr(2, 4) + $('#name').val(modelName) + $('#version').val("0.0.1") + } function renderSize(value){ if(null==value||value==''){ return "0 Bytes"; diff --git a/templates/repo/modelmanage/index.tmpl b/templates/repo/modelmanage/index.tmpl index c83816c62..5dd54a6d3 100644 --- a/templates/repo/modelmanage/index.tmpl +++ b/templates/repo/modelmanage/index.tmpl @@ -104,7 +104,6 @@
-
@@ -118,7 +117,6 @@
-