Browse Source

限制调试数据集大小

tags/v1.22.12.2^2
Gitea 3 years ago
parent
commit
bbf4d0623f
5 changed files with 11 additions and 10 deletions
  1. +2
    -2
      modules/setting/setting.go
  2. +4
    -1
      modules/templates/helper.go
  3. +2
    -2
      routers/repo/cloudbrain.go
  4. +0
    -2
      routers/repo/dataset.go
  5. +3
    -3
      routers/repo/modelarts.go

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

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

//benchmark config
IsBenchmarkEnabled bool
@@ -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")
DebugDatasetSize = sec.Key("DEBUG_DATASET_SIZE").MustInt(20 * 1024 * 1024 * 1024)
DebugAttachSize = sec.Key("DEBUG_DATASET_SIZE").MustInt(20 * 1024 * 1024 * 1024)

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


+ 4
- 1
modules/templates/helper.go View File

@@ -97,6 +97,9 @@ func NewFuncMap() []template.FuncMap {
"AllowedReactions": func() []string {
return setting.UI.Reactions
},
"DebugAttachSize": func() int {
return setting.DebugAttachSize
},
"AvatarLink": models.AvatarLink,
"Safe": Safe,
"SafeJS": SafeJS,
@@ -151,7 +154,7 @@ func NewFuncMap() []template.FuncMap {
"EscapePound": func(str string) string {
return strings.NewReplacer("%", "%25", "#", "%23", " ", "%20", "?", "%3F").Replace(str)
},
"IpynbBool":func(str string) bool{
"IpynbBool": func(str string) bool {
return strings.Contains(str, ".ipynb")
},
"nl2br": func(text string) template.HTML {


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

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

if jobType == string(models.JobTypeDebug) {
for _, infos := range datasetInfos {
if infos.Size > int(setting.DebugDatasetSize) {
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.DebugDatasetSize / (1024*1024*1024))) // GB
log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize/(1024*1024*1024))) // GB
cloudBrainNewDataPrepare(ctx, jobType)
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize"), tpl, &form)
return


+ 0
- 2
routers/repo/dataset.go View File

@@ -522,8 +522,6 @@ func GetDatasetStatus(ctx *context.Context) {
return
}

log.Info(fmt.Sprint(attachment.DecompressState))
ctx.JSON(200, map[string]string{
"result_code": "0",
"UUID": UUID,


+ 3
- 3
routers/repo/modelarts.go View File

@@ -218,14 +218,14 @@ func Notebook2Create(ctx *context.Context, form auth.CreateModelArtsNotebookForm
return
}
}
var datasetInfos map[string]models.DatasetInfo
if uuid != "" {
datasetInfos, _, err = models.GetDatasetInfo(uuid)
for _, infos := range datasetInfos {
if infos.Size > int(setting.DebugDatasetSize) {
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.DebugDatasetSize))
log.Error("The DatasetSize exceeds the limit (%d)", int(setting.DebugAttachSize))
notebookNewDataPrepare(ctx)
ctx.RenderWithErr(ctx.Tr("cloudbrain.error.debug_datasetsize"), tplModelArtsNotebookNew, &form)
return


Loading…
Cancel
Save