fix: default limit
This commit is contained in:
parent
dcebf86408
commit
c3f2b21732
|
@ -127,9 +127,14 @@ class Stage(BaseModel):
|
|||
@classmethod
|
||||
def gather_cases(cls: Type["Stage"], values: Dict[str, Any]) -> Dict[str, Any]:
|
||||
cases = {k: v for k, v in values.items() if k.startswith("case")}
|
||||
for key in cases:
|
||||
limit = values.get("limit", {})
|
||||
parsed_cases = {}
|
||||
for key, case in cases.items():
|
||||
case_with_limit = {**limit, **case.get("limit", {})}
|
||||
case_for_parsing = {**case, "limit": case_with_limit}
|
||||
parsed_cases[key] = case_for_parsing
|
||||
values.pop(key)
|
||||
values["cases"] = {k: v for k, v in cases.items()}
|
||||
values["cases"] = parsed_cases
|
||||
return values
|
||||
|
||||
|
||||
|
|
|
@ -4,9 +4,13 @@ from functools import partial
|
|||
from pathlib import Path
|
||||
from typing import Any, Callable, Dict, List, Set, Tuple
|
||||
|
||||
from joj3_config_generator.models import const, result, task
|
||||
from joj3_config_generator.models import result, task
|
||||
from joj3_config_generator.models.common import Memory, Time
|
||||
from joj3_config_generator.models.const import JOJ3_CONFIG_ROOT
|
||||
from joj3_config_generator.models.const import (
|
||||
DEFAULT_CLOCK_LIMIT_MULTIPLIER,
|
||||
DEFAULT_PROC_LIMIT,
|
||||
JOJ3_CONFIG_ROOT,
|
||||
)
|
||||
from joj3_config_generator.models.task import Parser as ParserEnum
|
||||
|
||||
|
||||
|
@ -194,23 +198,19 @@ def fix_diff(
|
|||
),
|
||||
args=shlex.split(case_stage.command) if case_stage.command else None,
|
||||
cpu_limit=case_stage.limit.cpu,
|
||||
clock_limit=2 * case_stage.limit.cpu,
|
||||
clock_limit=DEFAULT_CLOCK_LIMIT_MULTIPLIER * case_stage.limit.cpu,
|
||||
memory_limit=case_stage.limit.mem,
|
||||
proc_limit=50,
|
||||
proc_limit=DEFAULT_PROC_LIMIT,
|
||||
)
|
||||
if cmd.args == executor.with_.default.args:
|
||||
cmd.args = None
|
||||
# duplicate with the fallback case in executor.with_
|
||||
if cmd.cpu_limit == const.DEFAULT_CPU_LIMIT:
|
||||
if cmd.cpu_limit == executor.with_.default.cpu_limit:
|
||||
cmd.cpu_limit = None
|
||||
if (
|
||||
cmd.clock_limit
|
||||
== const.DEFAULT_CLOCK_LIMIT_MULTIPLIER * const.DEFAULT_CPU_LIMIT
|
||||
):
|
||||
if cmd.clock_limit == executor.with_.default.clock_limit:
|
||||
cmd.clock_limit = None
|
||||
if cmd.memory_limit == const.DEFAULT_MEMORY_LIMIT:
|
||||
if cmd.memory_limit == executor.with_.default.memory_limit:
|
||||
cmd.memory_limit = None
|
||||
if cmd.proc_limit == const.DEFAULT_PROC_LIMIT:
|
||||
if cmd.proc_limit == executor.with_.default.proc_limit:
|
||||
cmd.proc_limit = None
|
||||
stage_cases.append(cmd)
|
||||
parser_case = result.DiffCasesConfig(
|
||||
|
|
|
@ -71,6 +71,8 @@
|
|||
"stdin": {
|
||||
"src": "/home/tt/.config/joj/diff/case0.in"
|
||||
},
|
||||
"cpuLimit": 1000000000,
|
||||
"clockLimit": 2000000000,
|
||||
"memoryLimit": 2097152
|
||||
},
|
||||
{
|
||||
|
|
|
@ -33,6 +33,7 @@ case1.diff.output.ignore_spaces = true
|
|||
case1.command = "./h7/build/ex2"
|
||||
|
||||
case9.diff.output.score = 1232131
|
||||
case9.limit.mem = "10m"
|
||||
|
||||
case11.diff.output.score = 92321
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user