From 504f6bd462fd89d9d0995a4a1a26c417b313b68e Mon Sep 17 00:00:00 2001 From: Gitea Date: Wed, 7 Dec 2022 16:31:51 +0800 Subject: [PATCH] fix-3262 --- modules/setting/setting.go | 2 +- modules/templates/helper.go | 2 +- routers/repo/cloudbrain.go | 5 ++--- routers/repo/modelarts.go | 5 ++--- 4 files changed, 6 insertions(+), 8 deletions(-) diff --git a/modules/setting/setting.go b/modules/setting/setting.go index b9b0f756e..e6254489f 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -1480,7 +1480,7 @@ func NewContext() { MaxDatasetNum = sec.Key("MAX_DATASET_NUM").MustInt(5) CullIdleTimeout = sec.Key("CULL_IDLE_TIMEOUT").MustString("900") CullInterval = sec.Key("CULL_INTERVAL").MustString("60") - DebugAttachSize = sec.Key("DEBUG_DATASET_SIZE").MustInt(20 * 1024 * 1024 * 1024) + DebugAttachSize = sec.Key("DEBUG_ATTACH_SIZE").MustInt(20) sec = Cfg.Section("benchmark") IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) diff --git a/modules/templates/helper.go b/modules/templates/helper.go index 3ae028499..89e470b87 100755 --- a/modules/templates/helper.go +++ b/modules/templates/helper.go @@ -98,7 +98,7 @@ func NewFuncMap() []template.FuncMap { return setting.UI.Reactions }, "DebugAttachSize": func() int { - return setting.DebugAttachSize + return setting.DebugAttachSize * 1024 * 1024 * 1024 }, "AvatarLink": models.AvatarLink, "Safe": Safe, diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 2cd6f3ee0..fdb1f832d 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -295,9 +295,8 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { if jobType == string(models.JobTypeDebug) { for _, infos := range datasetInfos { - if infos.Size > int(setting.DebugAttachSize) { - log.Info("datasize exceed limit, the size of dataset(GB)::", infos.Size) - log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize/(1024*1024*1024))) // GB + if infos.Size > int(setting.DebugAttachSize * 1024 * 1024 * 1024) { + log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) // GB cloudBrainNewDataPrepare(ctx, jobType) ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize"), tpl, &form) return diff --git a/routers/repo/modelarts.go b/routers/repo/modelarts.go index 96e408a76..9b987b440 100755 --- a/routers/repo/modelarts.go +++ b/routers/repo/modelarts.go @@ -223,9 +223,8 @@ func Notebook2Create(ctx *context.Context, form auth.CreateModelArtsNotebookForm if uuid != "" { datasetInfos, _, err = models.GetDatasetInfo(uuid) for _, infos := range datasetInfos { - if infos.Size > int(setting.DebugAttachSize) { - log.Info("datasize exceed limit, the size of dataset(GB)::", infos.Size) - log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) + if infos.Size > int(setting.DebugAttachSize * 1024 * 1024 * 1024) { + log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize)) //GB notebookNewDataPrepare(ctx) ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize"), tplModelArtsNotebookNew, &form) return