diff --git a/models/cloudbrain.go b/models/cloudbrain.go index b552ecde8..6652647dc 100755 --- a/models/cloudbrain.go +++ b/models/cloudbrain.go @@ -2424,7 +2424,7 @@ type DatasetInfo struct { DataLocalPath string Name string FullName string - Size int64 + Size int } func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) { @@ -2480,7 +2480,7 @@ func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetIn DataLocalPath: dataLocalPath, Name: fileName, FullName: attach.Name, - Size: attach.Size, + Size: int(attach.Size / (1024 * 1024 * 1024)), //GB } if i == 0 { datasetNames = attach.Name diff --git a/modules/setting/setting.go b/modules/setting/setting.go index ed09de790..5f4eeb53e 100755 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -518,7 +518,7 @@ var ( MaxDatasetNum int CullIdleTimeout string CullInterval string - DebugDatasetSize int64 + DebugDatasetSize int //benchmark config IsBenchmarkEnabled bool @@ -1480,6 +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") + DebugDatasetSize = sec.Key("DEBUG_DATASET_SIZE").MustInt(15) sec = Cfg.Section("benchmark") IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) diff --git a/routers/repo/cloudbrain.go b/routers/repo/cloudbrain.go index 05376f138..a01ef20e7 100755 --- a/routers/repo/cloudbrain.go +++ b/routers/repo/cloudbrain.go @@ -296,9 +296,16 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) { if jobType == string(models.JobTypeDebug) { for _, infos := range datasetInfos { - log.Info("the size of dataset", infos.Size) + log.Info("the size of dataset(GB):", infos.Size) + + if infos.Size > int(setting.DebugDatasetSize) { + log.Info("datasize exceed limit:", infos.Size) + log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugDatasetSize)) + cloudBrainNewDataPrepare(ctx, jobType) + ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize"), tpl, &form) + return + } } - } }