From 3952a2f60c04d6668e09826642fb2d3f117439e6 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 11 Jan 2023 16:31:17 +0800 Subject: [PATCH 01/31] =?UTF-8?q?#3088=20=E3=80=90=E6=A8=A1=E5=9E=8B?= =?UTF-8?q?=E5=AE=89=E5=85=A8=E8=AF=84=E6=B5=8B=E3=80=91testing=E7=8A=B6?= =?UTF-8?q?=E6=80=81=E5=A2=9E=E5=8A=A0=E5=9B=BE=E6=A0=87=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- web_src/less/openi.less | 1 + 1 file changed, 1 insertion(+) diff --git a/web_src/less/openi.less b/web_src/less/openi.less index 141cd59e7..e80e864a4 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -298,6 +298,7 @@ footer .column { background-position: -496px -52px; background-position: -459px -52px; } +.TESTING, .RUNNING { display: inline-block; width: 18px; From 5153875bc7d4f897e690463e7042af73835fb713 Mon Sep 17 00:00:00 2001 From: zouap Date: Wed, 11 Jan 2023 17:16:44 +0800 Subject: [PATCH 02/31] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/user/auth.go | 12 +++++++++--- web_src/less/openi.less | 1 - 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/routers/user/auth.go b/routers/user/auth.go index 9620cb969..d28ecdb3a 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -276,7 +276,7 @@ func SignInPostAPI(ctx *context.Context) { func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { ctx.Data["Title"] = ctx.Tr("sign_in") - + log.Info("here111") orderedOAuth2Names, oauth2Providers, err := models.GetActiveOAuth2Providers() if err != nil { ctx.ServerError("UserSignIn", err) @@ -291,7 +291,7 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { ctx.Data["IsCourse"] = ctx.QueryBool("course") ctx.Data["EnableSSPI"] = models.IsSSPIEnabled() ctx.Data["EnableCloudBrain"] = true - + log.Info("here222") if ctx.HasError() { ctx.HTML(200, tplSignIn) return @@ -326,6 +326,7 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { return } models.SaveLoginInfoToDb(ctx.Req.Request, u) + log.Info("here333") // If this user is enrolled in 2FA, we can't sign the user in just yet. // Instead, redirect them to the 2FA authentication page. _, err = models.GetTwoFactorByUID(u.ID) @@ -337,6 +338,7 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { } return } + log.Info("here444") // User needs to use 2FA, save data and redirect to 2FA page. if err := ctx.Session.Set("twofaUid", u.ID); err != nil { ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err) @@ -368,6 +370,7 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) { // SignInPost response for sign in request func SignInPost(ctx *context.Context, form auth.SignInForm) { + log.Info("here99999") ctx.Data["PageIsLogin"] = true ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login" ctx.Data["ActivityTpl"] = getActivityTpl() @@ -747,6 +750,7 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR // Register last login u.SetLastLogin() + log.Info("77777_2222") if err := models.UpdateUserCols(u, "last_login_unix"); err != nil { ctx.ServerError("UpdateUserCols", err) return setting.AppSubURL + "/dashboard" @@ -758,14 +762,16 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR ctx.RedirectToFirst(redirectToCourse) return redirectToCourse } + log.Info("77777_777") if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { + log.Info("77777_8888") ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) if obeyRedirect { ctx.RedirectToFirst(redirectTo) } return redirectTo } - + log.Info("77777_99999") if obeyRedirect { ctx.Redirect(setting.AppSubURL + "/dashboard") } diff --git a/web_src/less/openi.less b/web_src/less/openi.less index e80e864a4..141cd59e7 100644 --- a/web_src/less/openi.less +++ b/web_src/less/openi.less @@ -298,7 +298,6 @@ footer .column { background-position: -496px -52px; background-position: -459px -52px; } -.TESTING, .RUNNING { display: inline-block; width: 18px; From fa79d8e814be39c39cf4d2e88a34af9c1ad2fb3a Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 11 Jan 2023 17:58:11 +0800 Subject: [PATCH 03/31] fix issue --- web_src/vuepages/langs/config/en-US.js | 4 ++-- web_src/vuepages/langs/config/zh-CN.js | 4 ++-- web_src/vuepages/pages/notebook/debug/index.vue | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/web_src/vuepages/langs/config/en-US.js b/web_src/vuepages/langs/config/en-US.js index b74be1055..7e6dc25bc 100644 --- a/web_src/vuepages/langs/config/en-US.js +++ b/web_src/vuepages/langs/config/en-US.js @@ -207,8 +207,8 @@ const en = { npuEnv: "NPU environment", newTask: "Create new task", noQuene: "The current resources are sufficient and no tasks are queued", - queneTips1: "There are currently", - queneTips2: "tasks queued", + queneTips1: "Your current queue position is", + queneTips2: "", watiResource: "Waiting for resources to be allocated, please be patient", debug: "Debug", stop: "Stop", diff --git a/web_src/vuepages/langs/config/zh-CN.js b/web_src/vuepages/langs/config/zh-CN.js index 26e602564..f6a8f518d 100644 --- a/web_src/vuepages/langs/config/zh-CN.js +++ b/web_src/vuepages/langs/config/zh-CN.js @@ -208,8 +208,8 @@ const zh = { npuEnv: "NPU 环境", newTask: "新建任务", noQuene: "当前资源充足,没有任务排队", - queneTips1: "当前有", - queneTips2: "个任务正在排队", + queneTips1: "您当前排队位置是第", + queneTips2: "位", watiResource: "正在等待分配资源,请耐心等待", debug: "调试", stop: "停止", diff --git a/web_src/vuepages/pages/notebook/debug/index.vue b/web_src/vuepages/pages/notebook/debug/index.vue index 371f73bb8..fb40543a5 100644 --- a/web_src/vuepages/pages/notebook/debug/index.vue +++ b/web_src/vuepages/pages/notebook/debug/index.vue @@ -108,7 +108,7 @@
{{$t('notebook.noQuene')}} - {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountGpu}} {{$t('notebook.queneTips2')}} + {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountGpu + 1}} {{$t('notebook.queneTips2')}}
From 07b08edd3849b0876e38f454e75b3d3ea6474a51 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Wed, 11 Jan 2023 18:03:34 +0800 Subject: [PATCH 04/31] fix issue --- web_src/vuepages/pages/notebook/debug/index.vue | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/web_src/vuepages/pages/notebook/debug/index.vue b/web_src/vuepages/pages/notebook/debug/index.vue index fb40543a5..cf212a3d4 100644 --- a/web_src/vuepages/pages/notebook/debug/index.vue +++ b/web_src/vuepages/pages/notebook/debug/index.vue @@ -131,7 +131,7 @@
{{$t('notebook.noQuene')}} - {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountNpu}} {{$t('notebook.queneTips2')}} + {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountNpu + 1}} {{$t('notebook.queneTips2')}}
@@ -153,7 +153,7 @@
{{$t('notebook.noQuene')}} - {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountGpu}} {{$t('notebook.queneTips2')}} + {{$t('notebook.queneTips1')}} {{notebookInfo.waitCountGpu + 1}} {{$t('notebook.queneTips2')}}
From dac7cab4777df290653ed778a346fe0cf0c0e6be Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 12 Jan 2023 15:55:55 +0800 Subject: [PATCH 05/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7=E5=A2=9E=E9=95=BF?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 2 +- routers/user/auth.go | 7 ------- 2 files changed, 1 insertion(+), 8 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index ee1b17544..b6d51f24b 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -1391,7 +1391,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, useMetrics.TotalActivateRegistUser = getMapKeyStringValue("TotalActivateRegistUser", userMetrics) useMetrics.TotalHasActivityUser = getMapKeyStringValue("TotalHasActivityUser", userMetrics) useMetrics.CurrentDayRegistUser = getMapKeyStringValue("CurrentDayRegistUser", userMetrics) - count, err = sess.Where("type=0").Count(new(User)) + count, err = sess.Where("type=0 and created_unix<=" + fmt.Sprint(end_unix)).Count(new(User)) if err != nil { log.Info("query user error. return.") } diff --git a/routers/user/auth.go b/routers/user/auth.go index d28ecdb3a..52b2a77b5 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -326,7 +326,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { return } models.SaveLoginInfoToDb(ctx.Req.Request, u) - log.Info("here333") // If this user is enrolled in 2FA, we can't sign the user in just yet. // Instead, redirect them to the 2FA authentication page. _, err = models.GetTwoFactorByUID(u.ID) @@ -338,7 +337,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { } return } - log.Info("here444") // User needs to use 2FA, save data and redirect to 2FA page. if err := ctx.Session.Set("twofaUid", u.ID); err != nil { ctx.ServerError("UserSignIn: Unable to set twofaUid in session", err) @@ -370,7 +368,6 @@ func SignInCloudBrainPost(ctx *context.Context, form auth.SignInForm) { // SignInPost response for sign in request func SignInPost(ctx *context.Context, form auth.SignInForm) { - log.Info("here99999") ctx.Data["PageIsLogin"] = true ctx.Data["SignInLink"] = setting.AppSubURL + "/user/login" ctx.Data["ActivityTpl"] = getActivityTpl() @@ -750,7 +747,6 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR // Register last login u.SetLastLogin() - log.Info("77777_2222") if err := models.UpdateUserCols(u, "last_login_unix"); err != nil { ctx.ServerError("UpdateUserCols", err) return setting.AppSubURL + "/dashboard" @@ -762,16 +758,13 @@ func handleSignInFull(ctx *context.Context, u *models.User, remember bool, obeyR ctx.RedirectToFirst(redirectToCourse) return redirectToCourse } - log.Info("77777_777") if redirectTo := ctx.GetCookie("redirect_to"); len(redirectTo) > 0 && !util.IsExternalURL(redirectTo) { - log.Info("77777_8888") ctx.SetCookie("redirect_to", "", -1, setting.AppSubURL, "", setting.SessionConfig.Secure, true) if obeyRedirect { ctx.RedirectToFirst(redirectTo) } return redirectTo } - log.Info("77777_99999") if obeyRedirect { ctx.Redirect(setting.AppSubURL + "/dashboard") } From 9def35594b4b72200a2b9a37c25b95744f592077 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 12 Jan 2023 15:57:42 +0800 Subject: [PATCH 06/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E7=94=A8=E6=88=B7=E5=A2=9E=E9=95=BF?= =?UTF-8?q?=E8=B6=8B=E5=8A=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/user/auth.go | 2 -- 1 file changed, 2 deletions(-) diff --git a/routers/user/auth.go b/routers/user/auth.go index 52b2a77b5..61f53e200 100755 --- a/routers/user/auth.go +++ b/routers/user/auth.go @@ -276,7 +276,6 @@ func SignInPostAPI(ctx *context.Context) { func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { ctx.Data["Title"] = ctx.Tr("sign_in") - log.Info("here111") orderedOAuth2Names, oauth2Providers, err := models.GetActiveOAuth2Providers() if err != nil { ctx.ServerError("UserSignIn", err) @@ -291,7 +290,6 @@ func SignInPostCommon(ctx *context.Context, form auth.SignInForm) { ctx.Data["IsCourse"] = ctx.QueryBool("course") ctx.Data["EnableSSPI"] = models.IsSSPIEnabled() ctx.Data["EnableCloudBrain"] = true - log.Info("here222") if ctx.HasError() { ctx.HTML(200, tplSignIn) return From caaf1426a8fdccec5bd24d652aa8aa4860e4edc1 Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 12 Jan 2023 16:07:29 +0800 Subject: [PATCH 07/31] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 1 + 1 file changed, 1 insertion(+) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index b6d51f24b..6649dec74 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -1043,6 +1043,7 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem trainscore = float64(dateRecordAll.GpuTrainJob+dateRecordAll.NpuTrainJob) / float64(50) } cloudBrainInfo["inference_task_num"] = fmt.Sprint(dateRecordAll.NpuInferenceJob + CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_GpuInferenceJob"]) + cloudBrainInfo["benchmark_task_num"] = fmt.Sprint(dateRecordAll.GpuBenchMarkJob) cloudBrainInfo["card_runtime"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime) cloudBrainInfo["card_runtime_money"] = fmt.Sprint(dateRecordAll.CloudBrainRunTime * 5) cloudBrainInfo["CloudBrainOne"] = fmt.Sprint(CloudBrainTaskItemMap[fmt.Sprint(dateRecordAll.ID)+"_CloudBrainOne"]) From 3eece6ec6dd599c74c43405f7b19aa276c71294c Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 12 Jan 2023 16:09:25 +0800 Subject: [PATCH 08/31] =?UTF-8?q?=E5=B9=B4=E5=BA=A6=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E4=B8=AD=E5=A2=9E=E5=8A=A0=E8=AF=84=E6=B5=8B=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E7=BB=9F=E8=AE=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 6649dec74..2b71826fe 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -2516,6 +2516,8 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s setMapKey("NpuTrainJob", cloudTaskRecord.UserID, 1, resultItemMap) } else if cloudTaskRecord.JobType == "INFERENCE" { setMapKey("NpuInferenceJob", cloudTaskRecord.UserID, 1, resultItemMap) + } else if cloudTaskRecord.JobType == "BENCHMARK" { + setMapKey("GpuBenchMarkJob", cloudTaskRecord.UserID, 1, resultItemMap) } else { setMapKey("NpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap) } From 72102c526e8ceee16cf92d24d86da52f7639cb1d Mon Sep 17 00:00:00 2001 From: zouap Date: Thu, 12 Jan 2023 16:28:09 +0800 Subject: [PATCH 09/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=B9=B4=E5=BA=A6=E6=8A=A5=E5=91=8A?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=E8=AF=84=E6=B5=8B=E4=BB=BB=E5=8A=A1=E5=AD=97?= =?UTF-8?q?=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 2b71826fe..cf0ad7e1a 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -2516,7 +2516,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s setMapKey("NpuTrainJob", cloudTaskRecord.UserID, 1, resultItemMap) } else if cloudTaskRecord.JobType == "INFERENCE" { setMapKey("NpuInferenceJob", cloudTaskRecord.UserID, 1, resultItemMap) - } else if cloudTaskRecord.JobType == "BENCHMARK" { + } else if cloudTaskRecord.JobType == "BENCHMARK" || cloudTaskRecord.JobType == "MODELSAFETY" { setMapKey("GpuBenchMarkJob", cloudTaskRecord.UserID, 1, resultItemMap) } else { setMapKey("NpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap) @@ -2527,7 +2527,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s setMapKey("GpuTrainJob", cloudTaskRecord.UserID, 1, resultItemMap) } else if cloudTaskRecord.JobType == "INFERENCE" { setMapKey("GpuInferenceJob", cloudTaskRecord.UserID, 1, resultItemMap) - } else if cloudTaskRecord.JobType == "BENCHMARK" { + } else if cloudTaskRecord.JobType == "BENCHMARK" || cloudTaskRecord.JobType == "MODELSAFETY" { setMapKey("GpuBenchMarkJob", cloudTaskRecord.UserID, 1, resultItemMap) } else { setMapKey("GpuDebugJob", cloudTaskRecord.UserID, 1, resultItemMap) From 598a92c7ecc1618668346224f05a85a65c1d0e65 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 12 Jan 2023 16:31:47 +0800 Subject: [PATCH 10/31] fix issue --- routers/home.go | 4 ++++ routers/routes/routes.go | 1 + templates/annual_privacy.tmpl | 35 +++++++++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 templates/annual_privacy.tmpl diff --git a/routers/home.go b/routers/home.go index 40a41bd68..21b1db946 100755 --- a/routers/home.go +++ b/routers/home.go @@ -42,6 +42,7 @@ const ( tplExploreImages base.TplName = "explore/images" tplExploreExploreDataAnalysis base.TplName = "explore/data_analysis" tplHomeTerm base.TplName = "terms" + tplHomeAnnual base.TplName = "annual_privacy" tplHomePrivacy base.TplName = "privacy" tplResoruceDesc base.TplName = "resource_desc" tplRepoSquare base.TplName = "explore/repos/square" @@ -966,6 +967,9 @@ func RecommendHomeInfo(ctx *context.Context) { func HomeTerm(ctx *context.Context) { ctx.HTML(200, tplHomeTerm) } +func HomeAnnual(ctx *context.Context) { + ctx.HTML(200, tplHomeAnnual) +} func HomePrivacy(ctx *context.Context) { ctx.HTML(200, tplHomePrivacy) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 85e1b8a25..2def76ff4 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -359,6 +359,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/all/dosearch/", routers.SearchApi) m.Post("/user/login/kanban", user.SignInPostAPI) m.Get("/home/term", routers.HomeTerm) + m.Get("/home/annual_privacy", routers.HomeAnnual) m.Get("/home/notice", routers.HomeNoticeTmpl) m.Get("/home/privacy", routers.HomePrivacy) m.Get("/extension/tuomin/upload", modelapp.ProcessImageUI) diff --git a/templates/annual_privacy.tmpl b/templates/annual_privacy.tmpl new file mode 100644 index 000000000..32cee4a74 --- /dev/null +++ b/templates/annual_privacy.tmpl @@ -0,0 +1,35 @@ +{{template "base/head_home" .}} +
+

OpenI启智社区2022年度报告授权协议

+
+

+ 感谢您阅读《OpenI启智社区2022年度报告授权协议》!在您正式使用OpenI启智社区2022年度报告之前应仔细阅读并充分理解本协议中的全部内容,如您不同意本协议中的任何条款,请立即停止使用OpenI启智社区2022年度报告。您使用OpenI启智社区2022年度报告的行为将被视为已经仔细阅读、充分理解并毫无保留地接受本协议所有条款。 +

+ +

+ 1. 制作年度报告 +

+

+ OpenI启智社区2022年度报告将根据您在平台的历史信息,帮助您生成一份专属年度报告。为此,我们将使用2022自然年度您在OpenI启智社区产生的行为信息,包括但不限于用户名、注册时间、创建项目数、项目下载次数、commit次数、代码行数、创建数据集、上传数据集文件、数据集被收藏数、数据集下载数、云脑任务所有相关数据( GPU/NPU 调试任务、训练任务、运行卡时)。您理解并同意,上述信息是OpenI启智社区生成年度报告的必备信息,如您拒绝授权使用,OpenI启智社区将无法为您制作并提供专属年度报告。未经您的书面同意,我们保证不以超越本协议约定范围使用您的个人信息。 +

+

+ 2. 使用年度报告 +

+

+ OpenI启智社区提供的年度报告仅限您个人使用,您可自行留存欣赏或无偿分享、公开。您理解并同意,如因您分享、公开年度报告而产生的任何损失(包括但不限于个人信息泄露等)应由您自行承担,请您在分享、公开年度报告前审慎考虑。 +

+

+ 3. 知识产权 +

+

+ 年度报告及其内容(包括但不限于软件、技术、程序、网页、文字、图片、音频、视频、页面设计、商标等)的知识产权由OpenI启智社区享有,您理解并同意,您不得超越本协议目的使用年度报告中的内容素材,如您希望以任何形式将年度报告中的内容素材用于本协议约定范围之外,应当经过所有实际权利人的书面许可。 +

+

+ 4. 隐私政策 +

+

+ 其他本隐私保护指引未有涉及的,将适用《OpenI启智社区AI协作平台使用协议》和《OpenI启智社区AI协作平台隐私协议》。 +

+ +
+{{template "base/footer" .}} \ No newline at end of file From 25ba6c092e488d655c30edbad918a0d6ea833207 Mon Sep 17 00:00:00 2001 From: liuzx Date: Thu, 12 Jan 2023 17:47:16 +0800 Subject: [PATCH 11/31] fix-3480 --- routers/repo/grampus.go | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index d33fce106..9c204aff2 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -1308,7 +1308,7 @@ func GrampusTrainJobShow(ctx *context.Context) { taskList := make([]*models.Cloudbrain, 0) taskList = append(taskList, task) prepareSpec4Show(ctx, task) - + ctx.Data["version_list_task"] = taskList ctx.Data["datasetDownload"] = GetCloudBrainDataSetInfo(task.Uuid, task.DatasetName, false) ctx.Data["canDownload"] = cloudbrain.CanModifyJob(ctx, task) @@ -1349,9 +1349,9 @@ func GrampusGetLog(ctx *context.Context) { return } - content, err := grampus.GetTrainJobLog(job.JobID) + result, err := grampus.GetJob(jobID) if err != nil { - log.Error("GetTrainJobLog failed: %v", err, ctx.Data["MsgID"]) + log.Error("GetJob(%s) failed:%v", job.JobName, err) ctx.JSON(http.StatusOK, map[string]interface{}{ "JobName": job.JobName, "Content": "", @@ -1359,20 +1359,26 @@ func GrampusGetLog(ctx *context.Context) { }) return } - result, err := grampus.GetJob(jobID) + exitDiagnostics := "" + if result != nil { + exitDiagnostics = result.ExitDiagnostics + } + + content, err := grampus.GetTrainJobLog(job.JobID) if err != nil { - log.Error("GetJob(%s) failed:%v", job.JobName, err) + log.Error("GetTrainJobLog failed: %v", err, ctx.Data["MsgID"]) ctx.JSON(http.StatusOK, map[string]interface{}{ "JobName": job.JobName, - "Content": content, + "Content": exitDiagnostics, "CanLogDownload": false, }) return } + if result != nil { job.Status = grampus.TransTrainJobStatus(result.JobInfo.Status) if job.Status == models.GrampusStatusFailed { - content = content + "\n" + result.ExitDiagnostics + content = content + "\n" + exitDiagnostics } } From f19ee6f7adf2e1513a2e30ed41fb3a63edd94090 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Thu, 12 Jan 2023 17:54:52 +0800 Subject: [PATCH 12/31] fix issue --- templates/repo/grampus/notebook/gcu/new.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/grampus/notebook/gcu/new.tmpl b/templates/repo/grampus/notebook/gcu/new.tmpl index eed6c7a29..8698447fb 100644 --- a/templates/repo/grampus/notebook/gcu/new.tmpl +++ b/templates/repo/grampus/notebook/gcu/new.tmpl @@ -3,7 +3,7 @@
{{template "repo/header" .}}
- + {{if eq .NotStopTaskCount 0}} {{template "base/alert" .}} {{end}} From 1ed1f83424b56711c475e720f52525aa28d345d4 Mon Sep 17 00:00:00 2001 From: changeorl Date: Thu, 12 Jan 2023 20:03:39 +0800 Subject: [PATCH 13/31] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/cloudbrain.go | 12 +++++++----- options/locale/locale_en-US.ini | 1 + options/locale/locale_zh-CN.ini | 2 +- routers/repo/cloudbrain.go | 19 ++++++++++--------- routers/repo/grampus.go | 10 ++++++++++ routers/repo/modelarts.go | 8 ++++---- 6 files changed, 33 insertions(+), 19 deletions(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index e0df17753..f84d994bc 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1470,7 +1470,7 @@ type GetNotebookListResult struct { NotebookList []NotebookList `json:"data"` } -//Grampus +// Grampus type GrampusResult struct { ErrorCode int `json:"errorCode"` ErrorMsg string `json:"errorMsg"` @@ -2200,8 +2200,10 @@ func GetGPUStoppedNotDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) Find(&cloudbrains) } -/** - 本方法考虑了再次调试的情况,多次调试取最后一次的任务的结束时间 +/* +* + + 本方法考虑了再次调试的情况,多次调试取最后一次的任务的结束时间 */ func GetGPUStoppedDebugJobDaysAgo(days int, limit int) ([]*Cloudbrain, error) { cloudbrains := make([]*Cloudbrain, 0, 10) @@ -2664,7 +2666,7 @@ type DatasetInfo struct { Name string FullName string Type int - Size int + Size int64 } func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) { @@ -2727,7 +2729,7 @@ func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetIn Name: fileName, FullName: attach.Name, Type: attach.Type, - Size: int(attach.Size), + Size: attach.Size, } if i == 0 { datasetNames = attach.Name diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 5fc02c609..ecd2598b7 100755 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -3322,6 +3322,7 @@ Stopped_failed=Fail to stop the job, please try again later. Stopped_success_update_status_fail=Succeed in stopping th job, but failed to update the job status and duration time. load_code_failed=Fail to load code, please check if the right branch is selected. +error.debug_datasetsize = The size of dataset exceeds limitation (%dGB) error.dataset_select = dataset select error:the count exceed the limit or has same name error.partial_datasets_not_available = There are non-existent or deleted files in the selected dataset file, please select again new_train_gpu_tooltips = The code is storaged in %s, the dataset is storaged in %s, the pre-trained model is storaged in the run parameter %s, and please put your model into %s then you can download it online diff --git a/options/locale/locale_zh-CN.ini b/options/locale/locale_zh-CN.ini index 4dc2e4c89..5cef94087 100755 --- a/options/locale/locale_zh-CN.ini +++ b/options/locale/locale_zh-CN.ini @@ -3343,7 +3343,7 @@ Stopped_failed=任务停止失败,请稍后再试。 Stopped_success_update_status_fail=任务停止成功,状态及运行时间更新失败。 load_code_failed=代码加载失败,请确认选择了正确的分支。 -error.debug_datasetsize = 数据集大小超过限制('%d'GB) +error.debug_datasetsize = 数据集大小超过限制(%dGB) error.dataset_select = 数据集选择错误:数量超过限制或者有同名数据集 error.partial_datasets_not_available = 选择的数据集文件中有不存在或已删除的文件,请重新选择 new_train_gpu_tooltips = 训练脚本存储在 %s 中,数据集存储在 %s 中,预训练模型存放在运行参数 %s 中,训练输出请存储在 %s 中以供后续下载。 diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index cf6df6312..6d25511cc 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -285,7 +285,7 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { } var datasetInfos map[string]models.DatasetInfo var datasetNames string - var attachSize int + var attachSize int64 if uuids != "" { datasetInfos, datasetNames, err = models.GetDatasetInfo(uuids) if err != nil { @@ -299,10 +299,10 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { for _, infos := range datasetInfos { attachSize += infos.Size } - if attachSize > int(setting.DebugAttachSize*1000*1000*1000) { - log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) // GB + if attachSize > int64(setting.DebugAttachSize*1000*1000*1000) { + log.Error("The DatasetSize exceeds the limit (%dGB)", setting.DebugAttachSize) // GB cloudBrainNewDataPrepare(ctx, jobType) - ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", int(setting.DebugAttachSize*1000*1000*1000)), tpl, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", setting.DebugAttachSize), tpl, &form) return } } @@ -603,8 +603,10 @@ func CloudBrainInferenceJobCreate(ctx *context.Context, form auth.CreateCloudBra } -/** - 检查用户传输的参数是否符合专属资源池 +/* +* + + 检查用户传输的参数是否符合专属资源池 */ func checkCloudBrainSpecialPool(ctx *context.Context, jobType string, queue string, resourceSpecId int) string { if cloudbrain.SpecialPools != nil { @@ -746,7 +748,6 @@ func CloudBrainRestart(ctx *context.Context) { }) } - func hasDatasetDeleted(task *models.Cloudbrain) bool { if task.Uuid == "" { return false @@ -1321,8 +1322,8 @@ func DeleteJobsByRepoID(repoID int64) { DeleteJobs(cloudBrains) } -/** - +/* +* */ func StopJobs(cloudBrains []*models.Cloudbrain) { diff --git a/routers/repo/grampus.go b/routers/repo/grampus.go index 254cc6203..74e2f06d6 100755 --- a/routers/repo/grampus.go +++ b/routers/repo/grampus.go @@ -202,6 +202,7 @@ func GrampusNotebookCreate(ctx *context.Context, form auth.CreateGrampusNotebook var datasetInfos map[string]models.DatasetInfo var datasetNames string + var attachSize int64 //var if uuid != "" { datasetInfos, datasetNames, err = models.GetDatasetInfo(uuid, computeSourceSimple) @@ -217,6 +218,15 @@ func GrampusNotebookCreate(ctx *context.Context, form auth.CreateGrampusNotebook ctx.RenderWithErr(ctx.Tr("cloudbrain.error.partial_datasets_not_available"), tpl, &form) return } + for _, infos := range datasetInfos { + attachSize += infos.Size + } + if attachSize > int64(setting.DebugAttachSize*1000*1000*1000) { + log.Error("The DatasetSize exceeds the limit (%dGB)", setting.DebugAttachSize) // GB + grampusNotebookNewDataPrepare(ctx, processType) + ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", setting.DebugAttachSize), tpl, &form) + return + } } //prepare code and out path diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index fe109422e..6fec40651 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -220,16 +220,16 @@ func Notebook2Create(ctx *context.Context, form auth.CreateModelArtsNotebookForm } var datasetInfos map[string]models.DatasetInfo - var attachSize int + var attachSize int64 if uuid != "" { datasetInfos, _, err = models.GetDatasetInfo(uuid) for _, infos := range datasetInfos { attachSize += infos.Size } - if attachSize > int(setting.DebugAttachSize*1000*1000*1000) { - log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) //GB + if attachSize > int64(setting.DebugAttachSize*1000*1000*1000) { + log.Error("The DatasetSize exceeds the limit (%dGB)", setting.DebugAttachSize) //GB notebookNewDataPrepare(ctx) - ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", int(setting.DebugAttachSize*1000*1000*1000)), tplModelArtsNotebookNew, &form) + ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize", setting.DebugAttachSize), tplModelArtsNotebookNew, &form) return } } From f90ce96f66850b28fc5a23bac8c48ad0c1179d0d Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 13 Jan 2023 10:35:45 +0800 Subject: [PATCH 14/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E5=8D=87=E6=9F=A5=E8=AF=A2action=E8=A1=A8?= =?UTF-8?q?=E7=9A=84=E9=80=9F=E5=BA=A6=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 57 +++++++++++++++++++++++++++------------- 1 file changed, 39 insertions(+), 18 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index cf0ad7e1a..f6f58396b 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -1756,36 +1756,42 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) (map[ var indexTotal int64 indexTotal = 0 for { - sess.Select("id,user_id,op_type,act_user_id,created_unix").Table("action").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) - actionList := make([]*Action, 0) - sess.Find(&actionList) - + //sess.Select("id,user_id,op_type,act_user_id,created_unix").Table("action").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) + //actionList := make([]*Action, 0) + //sess.Find(&actionList) + actionList, err := sess.QueryInterface("select id,user_id,op_type,act_user_id,created_unix from public.action where " + cond + " order by id asc limit " + fmt.Sprint(PAGE_SIZE) + " offset " + fmt.Sprint(indexTotal)) + if err != nil { + log.Info("error:" + err.Error()) + continue + } log.Info("query action size=" + fmt.Sprint(len(actionList))) for _, actionRecord := range actionList { - if int64(actionRecord.OpType) == actionType { - if _, ok := resultMap[actionRecord.UserID]; !ok { - resultMap[actionRecord.UserID] = 1 + userId := convertInterfaceToInt64(actionRecord["user_id"]) + if convertInterfaceToInt64(actionRecord["op_type"]) == actionType { + if _, ok := resultMap[userId]; !ok { + resultMap[userId] = 1 } else { - resultMap[actionRecord.UserID] += 1 + resultMap[userId] += 1 } } - key := getDate(actionRecord.CreatedUnix) - if _, ok := mostActiveMap[actionRecord.UserID]; !ok { + created_unix := timeutil.TimeStamp(convertInterfaceToInt64(actionRecord["created_unix"])) + key := getDate(created_unix) + if _, ok := mostActiveMap[userId]; !ok { tmpMap := make(map[string]int) tmpMap[key] = 1 - mostActiveMap[actionRecord.UserID] = tmpMap + mostActiveMap[userId] = tmpMap } else { - mostActiveMap[actionRecord.UserID][key] = getMapKeyStringValue(key, mostActiveMap[actionRecord.UserID]) + 1 + mostActiveMap[userId][key] = getMapKeyStringValue(key, mostActiveMap[userId]) + 1 } - utcTime := actionRecord.CreatedUnix.AsTime() + utcTime := created_unix.AsTime() hour := utcTime.Hour() if hour >= 0 && hour <= 5 { key = "hour_hour" - if getMapKeyStringValue(key, mostActiveMap[actionRecord.UserID]) < hour { - mostActiveMap[actionRecord.UserID][key] = hour - mostActiveMap[actionRecord.UserID]["hour_day"] = utcTime.Day() - mostActiveMap[actionRecord.UserID]["hour_month"] = int(utcTime.Month()) - mostActiveMap[actionRecord.UserID]["hour_year"] = utcTime.Year() + if getMapKeyStringValue(key, mostActiveMap[userId]) < hour { + mostActiveMap[userId][key] = hour + mostActiveMap[userId]["hour_day"] = utcTime.Day() + mostActiveMap[userId]["hour_month"] = int(utcTime.Month()) + mostActiveMap[userId]["hour_year"] = utcTime.Year() } } } @@ -1797,6 +1803,21 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) (map[ return resultMap, mostActiveMap } + +func convertInterfaceToInt64(obj interface{}) int64 { + switch obj.(type) { + case int8: + return int64(obj.(int8)) + case int16: + return int64(obj.(int16)) + case int32: + return int64(obj.(int32)) + case int64: + return obj.(int64) + } + return 0 +} + func getDate(createTime timeutil.TimeStamp) string { return createTime.Format("2006-01-02") } From f6dc11037a084238a7b1a8a9215b5a5bcd7ef180 Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 13 Jan 2023 11:08:43 +0800 Subject: [PATCH 15/31] =?UTF-8?q?=E4=BC=98=E5=8C=96=E6=9F=A5=E8=AF=A2actio?= =?UTF-8?q?n=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 65 ++++++++++++++++++++++++++++------------ 1 file changed, 46 insertions(+), 19 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index f6f58396b..4be8b9cf2 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -330,7 +330,7 @@ func QueryUserStaticDataForUserDefine(opts *UserBusinessAnalysisQueryOptions, wi DataDate := currentTimeNow.Format("2006-01-02 15:04") CodeMergeCountMap := queryPullRequest(start_unix, end_unix) - CommitCountMap, _ := queryCommitAction(start_unix, end_unix, 5) + CommitCountMap := queryCommitAction(start_unix, end_unix, 5) IssueCountMap := queryCreateIssue(start_unix, end_unix) CommentCountMap := queryComment(start_unix, end_unix) @@ -586,7 +586,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS startTime := currentTimeNow.AddDate(0, 0, -1) CodeMergeCountMap := queryPullRequest(start_unix, end_unix) - CommitCountMap, _ := queryCommitAction(start_unix, end_unix, 5) + CommitCountMap := queryCommitAction(start_unix, end_unix, 5) IssueCountMap := queryCreateIssue(start_unix, end_unix) CommentCountMap := queryComment(start_unix, end_unix) @@ -762,7 +762,8 @@ func RefreshUserYearTable(pageStartTime time.Time, pageEndTime time.Time) { end_unix := pageEndTime.Unix() CodeMergeCountMap := queryPullRequest(start_unix, end_unix) - CommitCountMap, mostActiveMap := queryCommitAction(start_unix, end_unix, 5) + CommitCountMap := queryCommitAction(start_unix, end_unix, 5) + mostActiveMap := queryMostActiveCommitAction(start_unix, end_unix) IssueCountMap := queryCreateIssue(start_unix, end_unix) CommentCountMap := queryComment(start_unix, end_unix) @@ -1246,7 +1247,7 @@ func CounDataByDateAndReCount(wikiCountMap map[string]int, startTime time.Time, DataDate := CountDate.Format("2006-01-02") CodeMergeCountMap := queryPullRequest(start_unix, end_unix) - CommitCountMap, _ := queryCommitAction(start_unix, end_unix, 5) + CommitCountMap := queryCommitAction(start_unix, end_unix, 5) IssueCountMap := queryCreateIssue(start_unix, end_unix) CommentCountMap := queryComment(start_unix, end_unix) @@ -1740,40 +1741,30 @@ func queryPullRequest(start_unix int64, end_unix int64) map[int64]int { return resultMap } -func queryCommitAction(start_unix int64, end_unix int64, actionType int64) (map[int64]int, map[int64]map[string]int) { +func queryMostActiveCommitAction(start_unix int64, end_unix int64) map[int64]map[string]int { sess := x.NewSession() defer sess.Close() - resultMap := make(map[int64]int) + mostActiveMap := make(map[int64]map[string]int) cond := "user_id=act_user_id and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) count, err := sess.Where(cond).Count(new(Action)) if err != nil { log.Info("query action error. return.") - return resultMap, mostActiveMap + return mostActiveMap } var indexTotal int64 indexTotal = 0 for { - //sess.Select("id,user_id,op_type,act_user_id,created_unix").Table("action").Where(cond).OrderBy("id asc").Limit(PAGE_SIZE, int(indexTotal)) - //actionList := make([]*Action, 0) - //sess.Find(&actionList) actionList, err := sess.QueryInterface("select id,user_id,op_type,act_user_id,created_unix from public.action where " + cond + " order by id asc limit " + fmt.Sprint(PAGE_SIZE) + " offset " + fmt.Sprint(indexTotal)) if err != nil { log.Info("error:" + err.Error()) continue } - log.Info("query action size=" + fmt.Sprint(len(actionList))) + log.Info("query mostactive action size=" + fmt.Sprint(len(actionList))) for _, actionRecord := range actionList { userId := convertInterfaceToInt64(actionRecord["user_id"]) - if convertInterfaceToInt64(actionRecord["op_type"]) == actionType { - if _, ok := resultMap[userId]; !ok { - resultMap[userId] = 1 - } else { - resultMap[userId] += 1 - } - } created_unix := timeutil.TimeStamp(convertInterfaceToInt64(actionRecord["created_unix"])) key := getDate(created_unix) if _, ok := mostActiveMap[userId]; !ok { @@ -1800,8 +1791,44 @@ func queryCommitAction(start_unix int64, end_unix int64, actionType int64) (map[ break } } + return mostActiveMap +} - return resultMap, mostActiveMap +func queryCommitAction(start_unix int64, end_unix int64, actionType int64) map[int64]int { + sess := x.NewSession() + defer sess.Close() + resultMap := make(map[int64]int) + cond := "op_type=" + fmt.Sprint(actionType) + " and user_id=act_user_id and created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) + count, err := sess.Where(cond).Count(new(Action)) + if err != nil { + log.Info("query action error. return.") + return resultMap + } + var indexTotal int64 + indexTotal = 0 + for { + actionList, err := sess.QueryInterface("select id,user_id,op_type,act_user_id,created_unix from public.action where " + cond + " order by id asc limit " + fmt.Sprint(PAGE_SIZE) + " offset " + fmt.Sprint(indexTotal)) + if err != nil { + log.Info("error:" + err.Error()) + continue + } + log.Info("query action size=" + fmt.Sprint(len(actionList))) + for _, actionRecord := range actionList { + userId := convertInterfaceToInt64(actionRecord["user_id"]) + + if _, ok := resultMap[userId]; !ok { + resultMap[userId] = 1 + } else { + resultMap[userId] += 1 + } + + } + indexTotal += PAGE_SIZE + if indexTotal >= count { + break + } + } + return resultMap } func convertInterfaceToInt64(obj interface{}) int64 { From 36976b8f91c079e774b3812a9355c263a0ef058b Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 13 Jan 2023 16:00:02 +0800 Subject: [PATCH 16/31] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E6=A8=A1=E5=9E=8B=E7=AE=A1=E7=90=86=E7=9A=84=E8=AE=AD=E7=BB=83?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E5=B1=9E=E6=80=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/cloudbrain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/cloudbrain.go b/models/cloudbrain.go index e0df17753..9d1ed9aad 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -1859,7 +1859,7 @@ func QueryModelTrainJobList(repoId int64) ([]*Cloudbrain, int, error) { // ) cloudbrains := make([]*Cloudbrain, 0) - if err := sess.Select("job_id,display_job_name").Table(&Cloudbrain{}).Where(cond).OrderBy("created_unix DESC"). + if err := sess.Select("*").Table(&Cloudbrain{}).Where(cond).OrderBy("created_unix DESC"). Find(&cloudbrains); err != nil { return nil, 0, fmt.Errorf("Find: %v", err) } From 2b8185ee51700a371b620dae14e5392f8d4163d2 Mon Sep 17 00:00:00 2001 From: chenshihai Date: Fri, 13 Jan 2023 17:16:26 +0800 Subject: [PATCH 17/31] add agreement links --- templates/annual_privacy.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/annual_privacy.tmpl b/templates/annual_privacy.tmpl index 32cee4a74..2dd583338 100644 --- a/templates/annual_privacy.tmpl +++ b/templates/annual_privacy.tmpl @@ -28,7 +28,7 @@ 4. 隐私政策

- 其他本隐私保护指引未有涉及的,将适用《OpenI启智社区AI协作平台使用协议》和《OpenI启智社区AI协作平台隐私协议》。 + 其他本隐私保护指引未有涉及的,将适用《OpenI启智社区AI协作平台使用协议》《OpenI启智社区AI协作平台隐私协议》

From 52d5aa1708cc40701c93b26f90ece1376a4f7aaf Mon Sep 17 00:00:00 2001 From: zouap Date: Fri, 13 Jan 2023 18:11:15 +0800 Subject: [PATCH 18/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 8121f167c..07e87f7cc 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -922,6 +922,10 @@ func QueryUserLoginInfo(ctx *context.Context) { func QueryUserAnnualReport(ctx *context.Context) { log.Info("start to QueryUserAnnualReport ") - result := models.QueryUserAnnualReport(ctx.User.ID) - ctx.JSON(http.StatusOK, result) + if ctx.User == nil { + ctx.JSON(http.StatusOK, nil) + } else { + result := models.QueryUserAnnualReport(ctx.User.ID) + ctx.JSON(http.StatusOK, result) + } } From 752477ea0f5350042610a7edc49d3863e20603ca Mon Sep 17 00:00:00 2001 From: chenshihai Date: Fri, 13 Jan 2023 20:51:30 +0800 Subject: [PATCH 19/31] =?UTF-8?q?#3553=20=E3=80=90gcu=E8=B0=83=E8=AF=95?= =?UTF-8?q?=E3=80=91=E9=A6=96=E9=A1=B5=E5=8A=A8=E6=80=81=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E7=B1=BB=E5=9E=8B=E6=98=BE=E7=A4=BA=E4=B8=8D?= =?UTF-8?q?=E5=AF=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/home/home.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/home/home.js b/public/home/home.js index 2c70ca8ee..626a1302f 100755 --- a/public/home/home.js +++ b/public/home/home.js @@ -457,7 +457,7 @@ var actionNameZH={ "37":"提交的镜像 {image} 被设置为推荐镜像", "39":"创建了CPU/GPU类型调试任务", "40":"创建了NPU类型调试任务", - "41":"创建了GCU类型训练任务", + "41":"创建了GCU类型调试任务", }; var actionNameEN={ From d01c0c485d026508367eed318cbdd3dd326f4d9b Mon Sep 17 00:00:00 2001 From: yanchao Date: Fri, 13 Jan 2023 23:05:30 +0800 Subject: [PATCH 20/31] fix-token-error --- routers/repo/modelarts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 6fec40651..86fbd5bdb 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -457,7 +457,7 @@ func NotebookDebug2(ctx *context.Context) { } if ctx.QueryTrim("file") != "" { - ctx.Redirect(getFileUrl(result.Url, ctx.QueryTrim("file")) + "?token=" + result.Token) + ctx.Redirect(getFileUrl(result.Url, ctx.QueryTrim("file")) + "&token=" + result.Token) } else { if task.BootFile != "" { go cloudbrainTask.UploadNotebookFiles(task) From 1bba6a8fdefa060e51193f5ef3b97c83024207eb Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 09:37:00 +0800 Subject: [PATCH 21/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=A2=9E=E5=8A=A0=E6=89=93=E5=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 4be8b9cf2..cb1970d23 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -842,9 +842,9 @@ func RefreshUserYearTable(pageStartTime time.Time, pageEndTime time.Time) { repoInfo := getRepoDetailInfo(DetailInfoMap, dateRecordAll.ID, MostDownloadMap) dataSetInfo, datasetscore := getDataSetInfo(dateRecordAll.ID, CreatedDataset, dataSetDownloadMap, CommitDatasetNumMap, CollectedDataset) scoreMap["datasetscore"] = datasetscore - codeInfo, codescore := getCodeInfo(dateRecordAll) + codeInfo, codescore := getCodeInfo(&dateRecordAll) scoreMap["codescore"] = codescore - cloudBrainInfo := getCloudBrainInfo(dateRecordAll, CloudBrainTaskItemMap, scoreMap) + cloudBrainInfo := getCloudBrainInfo(&dateRecordAll, CloudBrainTaskItemMap, scoreMap) playARoll := getPlayARoll(bonusMap, dateRecordAll.Name, scoreMap) re := &UserSummaryCurrentYear{ ID: dateRecordAll.ID, @@ -891,6 +891,8 @@ func getBonusWeekDataMap() map[int64][]int { if strings.HasSuffix(filenames[i], "\r") { filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] } + week, num := getWeekAndNum(filenames[i]) + log.Info("filenames[i]=" + filenames[i] + "week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { @@ -908,7 +910,6 @@ func getBonusWeekDataMap() map[int64][]int { userId := getInt64Value(aLine[0]) order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) - week, num := getWeekAndNum(filenames[i]) //log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) //email := lines[2] record, ok := bonusMap[userId] @@ -1028,7 +1029,7 @@ func getPlayARoll(bonusMap map[string]map[string]int, userName string, scoreMap } } -func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItemMap map[string]int, scoreMap map[string]float64) string { +func getCloudBrainInfo(dateRecordAll *UserBusinessAnalysisAll, CloudBrainTaskItemMap map[string]int, scoreMap map[string]float64) string { trainscore := 0.0 debugscore := 0.0 runtime := 0.0 @@ -1063,7 +1064,7 @@ func getCloudBrainInfo(dateRecordAll UserBusinessAnalysisAll, CloudBrainTaskItem } } -func getCodeInfo(dateRecordAll UserBusinessAnalysisAll) (string, float64) { +func getCodeInfo(dateRecordAll *UserBusinessAnalysisAll) (string, float64) { if dateRecordAll.CommitCount > 0 { codeInfo := make(map[string]string) codeInfo["commit_count"] = fmt.Sprint(dateRecordAll.CommitCount) From c096dbf2d7d4ca9321b1631a6addd4da02c7ec76 Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 09:59:45 +0800 Subject: [PATCH 22/31] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E5=91=A8=E5=BA=A6?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index cb1970d23..2a379095a 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -891,8 +891,6 @@ func getBonusWeekDataMap() map[int64][]int { if strings.HasSuffix(filenames[i], "\r") { filenames[i] = filenames[i][0 : len(filenames[i])-len("\r")] } - week, num := getWeekAndNum(filenames[i]) - log.Info("filenames[i]=" + filenames[i] + "week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) url = setting.RecommentRepoAddr + "bonus/weekdata/" + filenames[i] csvContent, err1 := GetContentFromPromote(url) if err1 == nil { @@ -910,6 +908,7 @@ func getBonusWeekDataMap() map[int64][]int { userId := getInt64Value(aLine[0]) order := getIntValue(aLine[2]) money := getIntValue(aLine[3]) + week, num := getWeekAndNum(filenames[i]) //log.Info("userId=" + fmt.Sprint(userId) + " order=" + fmt.Sprint(order) + " money=" + fmt.Sprint(money) + " week=" + fmt.Sprint(week) + " num=" + fmt.Sprint(num)) //email := lines[2] record, ok := bonusMap[userId] From afc362d047457daa008309d2dbf2470e5c0b15aa Mon Sep 17 00:00:00 2001 From: zouap Date: Sat, 14 Jan 2023 10:01:01 +0800 Subject: [PATCH 23/31] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E9=83=A8=E5=88=86?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 07e87f7cc..8121f167c 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -922,10 +922,6 @@ func QueryUserLoginInfo(ctx *context.Context) { func QueryUserAnnualReport(ctx *context.Context) { log.Info("start to QueryUserAnnualReport ") - if ctx.User == nil { - ctx.JSON(http.StatusOK, nil) - } else { - result := models.QueryUserAnnualReport(ctx.User.ID) - ctx.JSON(http.StatusOK, result) - } + result := models.QueryUserAnnualReport(ctx.User.ID) + ctx.JSON(http.StatusOK, result) } From 5741edfeb1c9d22e0cc1171c545da68b6eb16815 Mon Sep 17 00:00:00 2001 From: zouap Date: Sun, 15 Jan 2023 10:44:36 +0800 Subject: [PATCH 24/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 2a379095a..50d48eda4 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -2602,6 +2602,11 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s break } } + resultItemMapJson, _ := json.Marshal(resultItemMap) + log.Info("resultItemMapJson=" + string(resultItemMapJson)) + + resultMapJson, _ := json.Marshal(resultMap) + log.Info("resultMap=" + string(resultMapJson)) return resultMap, resultItemMap } From 5707e6969aa7091e7410cab43f84de532026499e Mon Sep 17 00:00:00 2001 From: zouap Date: Sun, 15 Jan 2023 10:49:06 +0800 Subject: [PATCH 25/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=B0=83=E8=AF=95bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index 8121f167c..b7b76fd71 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -719,7 +719,7 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) { endTime = endTime.UTC() log.Info("startTime time:" + startTime.Format("2006-01-02 15:04:05")) log.Info("endTime time:" + endTime.Format("2006-01-02 15:04:05")) - warnEmailMessage := "用户统计信息入库失败,请尽快定位。" + //warnEmailMessage := "用户统计信息入库失败,请尽快定位。" startYear := time.Date(USER_YEAR, 1, 1, 0, 0, 0, 1, t.Location()) endYear := startYear.AddDate(1, 0, 0) @@ -727,14 +727,14 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) { models.RefreshUserYearTable(startYear, endYear) //query wiki data - log.Info("start to time count data") - wikiMap, err := queryWikiCountMap(startTime, endTime) - //other user info data - err = models.CounDataByDateAndReCount(wikiMap, startTime, endTime, isReCount) - if err != nil { - log.Error("count user info error." + err.Error()) - mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) - } + // log.Info("start to time count data") + // wikiMap, err := queryWikiCountMap(startTime, endTime) + // //other user info data + // err = models.CounDataByDateAndReCount(wikiMap, startTime, endTime, isReCount) + // if err != nil { + // log.Error("count user info error." + err.Error()) + // mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + // } log.Info("end to count all user info data") } From 52d3ab8b541d8e1d284115e2e99cc309b968ac48 Mon Sep 17 00:00:00 2001 From: zouap Date: Sun, 15 Jan 2023 11:02:17 +0800 Subject: [PATCH 26/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E6=95=85=E9=9A=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 50d48eda4..42b55e04f 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -2537,11 +2537,12 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s resultItemMap := make(map[string]int) cond := " created_unix>=" + fmt.Sprint(start_unix) + " and created_unix<=" + fmt.Sprint(end_unix) - count, err := sess.Where(cond).Count(new(Cloudbrain)) + count, err := sess.Where(cond).Unscoped().Count(new(Cloudbrain)) if err != nil { log.Info("query cloudbrain error. return.") return resultMap, resultItemMap } + log.Info("count=" + fmt.Sprint(count)) var indexTotal int64 indexTotal = 0 for { From 51d08b6d0f6bf82a07700ef871cdb0660c840040 Mon Sep 17 00:00:00 2001 From: zouap Date: Sun, 15 Jan 2023 11:09:09 +0800 Subject: [PATCH 27/31] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BA=91=E8=84=91?= =?UTF-8?q?=E4=BB=BB=E5=8A=A1=E6=95=B0=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84?= =?UTF-8?q?Bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 42b55e04f..11f6d9d01 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -2542,7 +2542,7 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s log.Info("query cloudbrain error. return.") return resultMap, resultItemMap } - log.Info("count=" + fmt.Sprint(count)) + log.Info("cloudbrain count=" + fmt.Sprint(count)) var indexTotal int64 indexTotal = 0 for { @@ -2603,12 +2603,6 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s break } } - resultItemMapJson, _ := json.Marshal(resultItemMap) - log.Info("resultItemMapJson=" + string(resultItemMapJson)) - - resultMapJson, _ := json.Marshal(resultMap) - log.Info("resultMap=" + string(resultMapJson)) - return resultMap, resultItemMap } From 8a3700c827b9213bd2cc3f74db99f0a9f082c14a Mon Sep 17 00:00:00 2001 From: zouap Date: Sun, 15 Jan 2023 11:10:50 +0800 Subject: [PATCH 28/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=E4=BA=91=E8=84=91=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=95=B0=E9=87=8F=E4=B8=8D=E5=87=86=E7=A1=AE=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- routers/repo/user_data_analysis.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/routers/repo/user_data_analysis.go b/routers/repo/user_data_analysis.go index b7b76fd71..8121f167c 100755 --- a/routers/repo/user_data_analysis.go +++ b/routers/repo/user_data_analysis.go @@ -719,7 +719,7 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) { endTime = endTime.UTC() log.Info("startTime time:" + startTime.Format("2006-01-02 15:04:05")) log.Info("endTime time:" + endTime.Format("2006-01-02 15:04:05")) - //warnEmailMessage := "用户统计信息入库失败,请尽快定位。" + warnEmailMessage := "用户统计信息入库失败,请尽快定位。" startYear := time.Date(USER_YEAR, 1, 1, 0, 0, 0, 1, t.Location()) endYear := startYear.AddDate(1, 0, 0) @@ -727,14 +727,14 @@ func TimingCountDataByDateAndReCount(date string, isReCount bool) { models.RefreshUserYearTable(startYear, endYear) //query wiki data - // log.Info("start to time count data") - // wikiMap, err := queryWikiCountMap(startTime, endTime) - // //other user info data - // err = models.CounDataByDateAndReCount(wikiMap, startTime, endTime, isReCount) - // if err != nil { - // log.Error("count user info error." + err.Error()) - // mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) - // } + log.Info("start to time count data") + wikiMap, err := queryWikiCountMap(startTime, endTime) + //other user info data + err = models.CounDataByDateAndReCount(wikiMap, startTime, endTime, isReCount) + if err != nil { + log.Error("count user info error." + err.Error()) + mailer.SendWarnNotifyMail(setting.Warn_Notify_Mails, warnEmailMessage) + } log.Info("end to count all user info data") } From f43020f0355927d0004a4d29c060a253f9923c1a Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Mon, 16 Jan 2023 09:40:49 +0800 Subject: [PATCH 29/31] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- routers/api/v1/api.go | 1 + routers/api/v1/repo/datasets.go | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/routers/api/v1/api.go b/routers/api/v1/api.go index ba7346481..3a5ee5f57 100755 --- a/routers/api/v1/api.go +++ b/routers/api/v1/api.go @@ -738,6 +738,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Combo("/repositories/:id", reqToken()).Get(repo.GetByID) m.Group("/datasets/:username/:reponame", func() { + m.Get("", repo.CurrentRepoDatasetInfoWithoutAttachment) m.Get("/current_repo", repo.CurrentRepoDatasetMultiple) m.Get("/my_datasets", repo.MyDatasetsMultiple) m.Get("/public_datasets", repo.PublicDatasetMultiple) diff --git a/routers/api/v1/repo/datasets.go b/routers/api/v1/repo/datasets.go index 0223cf740..2dbda4fb6 100644 --- a/routers/api/v1/repo/datasets.go +++ b/routers/api/v1/repo/datasets.go @@ -51,6 +51,28 @@ func CurrentRepoDatasetMultiple(ctx *context.APIContext) { } +func CurrentRepoDatasetInfoWithoutAttachment(ctx *context.APIContext) { + dataset, err := models.GetDatasetByRepo(ctx.Repo.Repository) + + if err != nil { + log.Warn("can not get dataset.", err) + ctx.JSON(200, map[string]interface{}{ + "code": 0, + "message": "", + "data": []*api.Dataset{}, + }) + return + } + + dataset.Repo = ctx.Repo.Repository + ctx.JSON(200, map[string]interface{}{ + "code": 0, + "message": "", + "data": []*api.Dataset{convert.ToDataset(dataset)}, + }) + +} + func MyDatasetsMultiple(ctx *context.APIContext) { opts := &models.SearchDatasetOptions{ From 83e987abde89c1f776584d621bda940cf5922629 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Wed, 18 Jan 2023 14:51:43 +0800 Subject: [PATCH 30/31] #2901 fix bug --- routers/repo/cloudbrain.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 6d25511cc..64075e035 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -1353,14 +1353,11 @@ func StopJobs(cloudBrains []*models.Cloudbrain) { logErrorAndUpdateJobStatus(err, taskInfo) } } else if taskInfo.Type == models.TypeC2Net { - if taskInfo.JobType == string(models.JobTypeTrain) { - err := retry(3, time.Second*30, func() error { - _, err := grampus.StopJob(taskInfo.JobID) - return err - }) - logErrorAndUpdateJobStatus(err, taskInfo) - } - + err := retry(3, time.Second*30, func() error { + _, err := grampus.StopJob(taskInfo.JobID, taskInfo.JobType) + return err + }) + logErrorAndUpdateJobStatus(err, taskInfo) } } } From 4daf5e5cb7abcada5db5157a27f5c76aa89071e8 Mon Sep 17 00:00:00 2001 From: chenyifan01 Date: Thu, 19 Jan 2023 11:27:15 +0800 Subject: [PATCH 31/31] #3574 fix bug --- routers/routes/routes.go | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/routers/routes/routes.go b/routers/routes/routes.go index 2def76ff4..31bba2aeb 100755 --- a/routers/routes/routes.go +++ b/routers/routes/routes.go @@ -1190,7 +1190,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRight, repo.CloudBrainDownloadMultiModel) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.CloudBrainNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), context.PointAccount(), repo.CloudBrainCreate) m.Group("/benchmark", func() { m.Get("", reqRepoCloudBrainReader, repo.CloudBrainBenchmarkIndex) @@ -1201,7 +1201,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/rate", reqRepoCloudBrainReader, repo.GetRate) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.CloudBrainBenchmarkNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainBenchmarkCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), context.PointAccount(), repo.CloudBrainBenchmarkCreate) m.Get("/get_child_types", repo.GetChildTypes) }) @@ -1218,7 +1218,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainTrainJobVersionCreate) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.CloudBrainTrainJobNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), repo.CloudBrainCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainForm{}), context.PointAccount(), repo.CloudBrainCreate) }) m.Group("/inference-job", func() { m.Group("/:jobid", func() { @@ -1228,7 +1228,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadall", cloudbrain.AdminOrJobCreaterRightForTrain, repo.DownloadGPUInferenceResultFile) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceCloudBrainJobNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainInferencForm{}), repo.CloudBrainInferenceJobCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateCloudBrainInferencForm{}), context.PointAccount(), repo.CloudBrainInferenceJobCreate) }) }, context.RepoRef()) m.Group("/grampus", func() { @@ -1242,7 +1242,7 @@ func RegisterRoutes(m *macaron.Macaron) { }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.GrampusNotebookNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusNotebookForm{}), repo.GrampusNotebookCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusNotebookForm{}), context.PointAccount(), repo.GrampusNotebookCreate) }) m.Group("/train-job", func() { @@ -1257,11 +1257,11 @@ func RegisterRoutes(m *macaron.Macaron) { }) m.Group("/gpu", func() { m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.GrampusTrainJobGPUNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusTrainJobForm{}), repo.GrampusTrainJobGpuCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusTrainJobForm{}), context.PointAccount(), repo.GrampusTrainJobGpuCreate) }) m.Group("/npu", func() { m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.GrampusTrainJobNPUNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusTrainJobForm{}), repo.GrampusTrainJobNpuCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateGrampusTrainJobForm{}), context.PointAccount(), repo.GrampusTrainJobNpuCreate) }) }) }, context.RepoRef()) @@ -1310,7 +1310,7 @@ func RegisterRoutes(m *macaron.Macaron) { }) m.Get("/create_gpu", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.AiSafetyCreateForGetGPU) m.Get("/create_npu", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.AiSafetyCreateForGetNPU) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, repo.AiSafetyCreateForPost) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.AiSafetyCreateForPost) }, context.RepoRef()) m.Group("/debugjob", func() { @@ -1327,7 +1327,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Post("/del", cloudbrain.AdminOrOwnerOrJobCreaterRight, repo.NotebookDel) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.NotebookNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), repo.Notebook2Create) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsNotebookForm{}), context.PointAccount(), repo.Notebook2Create) }) m.Group("/train-job", func() { @@ -1340,10 +1340,10 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/download_multi_model", cloudbrain.AdminOrJobCreaterRightForTrain, repo.MultiModelDownload) m.Get("/download_log_file", cloudbrain.AdminOrJobCreaterRightForTrain, repo.TrainJobDownloadLogFile) m.Get("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, context.PointAccount(), repo.TrainJobNewVersion) - m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreateVersion) + m.Post("/create_version", reqWechatBind, cloudbrain.AdminOrJobCreaterRightForTrain, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), context.PointAccount(), repo.TrainJobCreateVersion) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.TrainJobNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), repo.TrainJobCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsTrainJobForm{}), context.PointAccount(), repo.TrainJobCreate) m.Get("/para-config-list", reqRepoCloudBrainReader, repo.TrainJobGetConfigList) }) @@ -1356,7 +1356,7 @@ func RegisterRoutes(m *macaron.Macaron) { m.Get("/downloadall", cloudbrain.AdminOrJobCreaterRightForTrain, repo.DownloadMultiResultFile) }) m.Get("/create", reqWechatBind, reqRepoCloudBrainWriter, context.PointAccount(), repo.InferenceJobNew) - m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsInferenceJobForm{}), repo.InferenceJobCreate) + m.Post("/create", reqWechatBind, reqRepoCloudBrainWriter, bindIgnErr(auth.CreateModelArtsInferenceJobForm{}), context.PointAccount(), repo.InferenceJobCreate) }) }, context.RepoRef())