Browse Source

fix-3262

tags/v1.22.12.2^2
Gitea 2 years ago
parent
commit
90a0ef946a
3 changed files with 13 additions and 5 deletions
  1. +2
    -2
      models/cloudbrain.go
  2. +2
    -1
      modules/setting/setting.go
  3. +9
    -2
      routers/repo/cloudbrain.go

+ 2
- 2
models/cloudbrain.go View File

@@ -2424,7 +2424,7 @@ type DatasetInfo struct {
DataLocalPath string DataLocalPath string
Name string Name string
FullName string FullName string
Size int64
Size int
} }


func GetDatasetInfo(uuidStr string, grampusType ...string) (map[string]DatasetInfo, string, error) { 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, DataLocalPath: dataLocalPath,
Name: fileName, Name: fileName,
FullName: attach.Name, FullName: attach.Name,
Size: attach.Size,
Size: int(attach.Size / (1024 * 1024 * 1024)), //GB
} }
if i == 0 { if i == 0 {
datasetNames = attach.Name datasetNames = attach.Name


+ 2
- 1
modules/setting/setting.go View File

@@ -518,7 +518,7 @@ var (
MaxDatasetNum int MaxDatasetNum int
CullIdleTimeout string CullIdleTimeout string
CullInterval string CullInterval string
DebugDatasetSize int64
DebugDatasetSize int


//benchmark config //benchmark config
IsBenchmarkEnabled bool IsBenchmarkEnabled bool
@@ -1480,6 +1480,7 @@ func NewContext() {
MaxDatasetNum = sec.Key("MAX_DATASET_NUM").MustInt(5) MaxDatasetNum = sec.Key("MAX_DATASET_NUM").MustInt(5)
CullIdleTimeout = sec.Key("CULL_IDLE_TIMEOUT").MustString("900") CullIdleTimeout = sec.Key("CULL_IDLE_TIMEOUT").MustString("900")
CullInterval = sec.Key("CULL_INTERVAL").MustString("60") CullInterval = sec.Key("CULL_INTERVAL").MustString("60")
DebugDatasetSize = sec.Key("DEBUG_DATASET_SIZE").MustInt(15)


sec = Cfg.Section("benchmark") sec = Cfg.Section("benchmark")
IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false) IsBenchmarkEnabled = sec.Key("ENABLED").MustBool(false)


+ 9
- 2
routers/repo/cloudbrain.go View File

@@ -296,9 +296,16 @@ func cloudBrainCreate(ctx *context.Context, form auth.CreateCloudBrainForm) {


if jobType == string(models.JobTypeDebug) { if jobType == string(models.JobTypeDebug) {
for _, infos := range datasetInfos { 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
}
} }

} }
} }




Loading…
Cancel
Save