Compare commits

..

No commits in common. "6825921f4f53d86c01225d0c451cdcb218c2e303" and "5a5f4e75bef94d778c47c531af2f1bf3fb45a436" have entirely different histories.

2 changed files with 13 additions and 22 deletions

View File

@ -15,38 +15,33 @@ var (
}{
"c": {""},
"cpp": {""},
"go": {""},
"rust": {""},
"python3": {"/usr/bin/python3"},
"pypy3": {"/usr/bin/pypy3"},
"rust": {""},
}
)
type ConfigRuntime struct {
TimeLimit int `json:"TimeLimit"` // in ms
MemoryLimit int `json:"MemoryLimit"` // in mb
NProcLimit int `json:"NProcLimit"`
WriteFileLimit int `json:"WriteFileLimit"` // in mb
TimeLimit int `json:"TimeLimit"` // in ms
MemoryLimit int `json:"MemoryLimit"` // in mb
NProcLimit int `json:"NProcLimit"`
}
var (
DefaultPrebuildRuntime = ConfigRuntime{
TimeLimit: 300000,
MemoryLimit: 256,
NProcLimit: 64,
WriteFileLimit: 1,
TimeLimit: 300000,
MemoryLimit: 256,
NProcLimit: 64,
}
DefaultCompileRuntime = ConfigRuntime{
TimeLimit: 60000,
MemoryLimit: 256,
NProcLimit: 64,
WriteFileLimit: 64,
TimeLimit: 60000,
MemoryLimit: 256,
NProcLimit: 64,
}
DefaultCheckRuntime = ConfigRuntime{
TimeLimit: 60000,
MemoryLimit: 128,
NProcLimit: 64,
WriteFileLimit: 16,
TimeLimit: 60000,
MemoryLimit: 128,
NProcLimit: 64,
}
)
@ -60,9 +55,6 @@ func (c *ConfigRuntime) Validate() error {
if c.NProcLimit <= 0 {
return errors.New("nproc limit <= 0")
}
if c.WriteFileLimit <= 0 {
return errors.New("write file limit <= 0")
}
return nil
}

View File

@ -25,7 +25,6 @@ func (s *service) SandboxArgsBuilder(meta *JudgeMeta, id int) string {
args = append(args, fmt.Sprintf("--memory_limit=%d", meta.Cfg.Lang.Runtime.Run.MemoryLimit))
args = append(args, fmt.Sprintf("--nproc_limit=%d", meta.Cfg.Lang.Runtime.Run.NProcLimit))
args = append(args, fmt.Sprintf("--time_limit=%d", meta.Cfg.Lang.Runtime.Run.TimeLimit))
args = append(args, fmt.Sprintf("--fsize_limit=%d", meta.Cfg.Lang.Runtime.Run.WriteFileLimit))
args = append(args, fmt.Sprintf("--sandbox_template=%s", meta.Cfg.Lang.Lang))
args = append(args, fmt.Sprintf("--sandbox_action=%s", "ret"))
args = append(args, fmt.Sprintf("--uid=%d", 1000))