diff --git a/joj3_config_generator/models/result.py b/joj3_config_generator/models/result.py index a8623a3..b61f989 100644 --- a/joj3_config_generator/models/result.py +++ b/joj3_config_generator/models/result.py @@ -2,7 +2,6 @@ from typing import Any, Dict, List, Optional, Union import humanfriendly from pydantic import BaseModel, Field -from pytimeparse.timeparse import timeparse class LocalFile(BaseModel): @@ -44,9 +43,9 @@ class Cmd(BaseModel): stdin: Optional[Union[InputFile | StreamIn]] = None stdout: Optional[Union[Collector | StreamOut]] = None stderr: Optional[Union[Collector | StreamOut]] = None - cpu_limit: int = Field(0, serialization_alias="cpuLimit") - real_cpu_limit: int = Field(0, serialization_alias="realCpuLimit") - clock_limit: int = Field(2 * timeparse("1s"), serialization_alias="clockLimit") + cpu_limit: int = Field(1_000_000_000, serialization_alias="cpuLimit") + real_cpu_limit: int = Field(1_000_000_000, serialization_alias="realCpuLimit") + clock_limit: int = Field(2 * 1_000_000_000, serialization_alias="clockLimit") memory_limit: int = Field( humanfriendly.parse_size("128m"), serialization_alias="memoryLimit" ) @@ -77,7 +76,7 @@ class OptionalCmd(BaseModel): cpu_limit: Optional[int] = Field(None, serialization_alias="cpuLimit") real_cpu_limit: Optional[int] = Field(None, serialization_alias="realCpuLimit") clock_limit: Optional[int] = Field( - 2 * timeparse("1s"), serialization_alias="clockLimit" + 2 * 1_000_000_000, serialization_alias="clockLimit" ) memory_limit: Optional[int] = Field( humanfriendly.parse_size("128m"), serialization_alias="memoryLimit" diff --git a/joj3_config_generator/models/task.py b/joj3_config_generator/models/task.py index 38a4861..f1c444f 100644 --- a/joj3_config_generator/models/task.py +++ b/joj3_config_generator/models/task.py @@ -4,7 +4,6 @@ from typing import Any, Dict, List, Optional, Type import humanfriendly from pydantic import BaseModel, Field, model_validator -from pytimeparse.timeparse import timeparse class ParserResultDetail(BaseModel): @@ -54,7 +53,7 @@ class Files(BaseModel): class Limit(BaseModel): mem: int = humanfriendly.parse_size("128M") - cpu: int = timeparse("1s") + cpu: int = 1_000_000_000 stderr: int = humanfriendly.parse_size("128M") stdout: int = humanfriendly.parse_size("128M") diff --git a/joj3_config_generator/processers/task.py b/joj3_config_generator/processers/task.py index 512e0d8..e7a411f 100644 --- a/joj3_config_generator/processers/task.py +++ b/joj3_config_generator/processers/task.py @@ -77,37 +77,37 @@ def get_executor_with_config( copy_in_cached={file: file for file in cached}, copy_out_cached=file_export if file_export is not None else [], cpu_limit=( - task_stage.limit.cpu * 1_000_000_000_000 + task_stage.limit.cpu * 1_000_000_000 if task_stage.limit is not None and task_stage.limit.cpu is not None - else 80 * 1_000_000_000_000 + else 80 * 1_000_000_000 ), clock_limit=( - 2 * task_stage.limit.cpu * 1_000_000_000_000 + 2 * task_stage.limit.cpu * 1_000_000_000 if task_stage.limit is not None and task_stage.limit.cpu is not None - else 80 * 1_000_000_000_000 + else 80 * 1_000_000_000 ), memory_limit=( task_stage.limit.mem * 1_024 * 1_024 if task_stage.limit is not None and task_stage.limit.mem is not None - else 800 * 1_024 * 1_024 + else 128 * 1_024 * 1_024 ), stderr=result.Collector( name="stderr", max=( - task_stage.limit.stderr * 1_000_000_000_000 + task_stage.limit.stderr * 1_000_000_000 if task_stage.limit is not None and task_stage.limit.stderr is not None - else 800 * 1_024 * 1_024 + else 128 * 1_024 * 1_024 ), pipe=True, ), stdout=result.Collector( name="stdout", max=( - task_stage.limit.stdout * 1_000_000_000_000 + task_stage.limit.stdout * 1_000_000_000 if task_stage.limit is not None and task_stage.limit.stdout is not None - else 800 * 1_024 * 1_024 + else 128 * 1_024 * 1_024 ), pipe=True, ), diff --git a/tests/convert/basic/task.json b/tests/convert/basic/task.json index 9384d49..0eb1814 100644 --- a/tests/convert/basic/task.json +++ b/tests/convert/basic/task.json @@ -18,9 +18,9 @@ "with": { "default": { "env": [], - "cpuLimit": 0, - "realCpuLimit": 0, - "clockLimit": 2, + "cpuLimit": 1000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000, "memoryLimit": 128000000, "stackLimit": 0, "procLimit": 50, @@ -52,7 +52,7 @@ "-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e", "-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml" ], - "clockLimit": 2, + "clockLimit": 2000000000, "memoryLimit": 128000000, "procLimit": 50, "copyOut": [ @@ -73,7 +73,7 @@ "env": [ "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" ], - "clockLimit": 2, + "clockLimit": 2000000000, "memoryLimit": 128000000, "procLimit": 50, "copyOut": [ @@ -115,17 +115,17 @@ }, "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, @@ -203,17 +203,17 @@ }, "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, @@ -304,17 +304,17 @@ }, "stdout": { "name": "stdout", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, @@ -431,17 +431,17 @@ }, "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, @@ -530,17 +530,17 @@ }, "stdout": { "name": "stdout", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, @@ -625,17 +625,17 @@ "env": [], "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 95656304705536, "stackLimit": 0, "procLimit": 50, @@ -762,9 +762,9 @@ "env": [ "LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log" ], - "cpuLimit": 0, - "realCpuLimit": 0, - "clockLimit": 2, + "cpuLimit": 1000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000, "memoryLimit": 128000000, "stackLimit": 0, "procLimit": 50, diff --git a/tests/convert/clang-tidy/task.json b/tests/convert/clang-tidy/task.json index b686a5e..6197bc0 100644 --- a/tests/convert/clang-tidy/task.json +++ b/tests/convert/clang-tidy/task.json @@ -32,17 +32,17 @@ }, "stdout": { "name": "stdout", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, diff --git a/tests/convert/cppcheck/task.json b/tests/convert/cppcheck/task.json index 6e78a28..690bac2 100644 --- a/tests/convert/cppcheck/task.json +++ b/tests/convert/cppcheck/task.json @@ -32,17 +32,17 @@ }, "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, diff --git a/tests/convert/cpplint/task.json b/tests/convert/cpplint/task.json index 9b78a1e..e09c8cb 100644 --- a/tests/convert/cpplint/task.json +++ b/tests/convert/cpplint/task.json @@ -31,17 +31,17 @@ }, "stdout": { "name": "stdout", - "max": 65000000000000, + "max": 65000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50, diff --git a/tests/convert/diff/task.json b/tests/convert/diff/task.json index 1056a33..eac19ea 100644 --- a/tests/convert/diff/task.json +++ b/tests/convert/diff/task.json @@ -24,17 +24,17 @@ "env": [], "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 95656304705536, "stackLimit": 0, "procLimit": 50, diff --git a/tests/convert/keyword/task.json b/tests/convert/keyword/task.json index c2bceb9..c7b212d 100644 --- a/tests/convert/keyword/task.json +++ b/tests/convert/keyword/task.json @@ -30,17 +30,17 @@ }, "stdout": { "name": "stdout", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, "stderr": { "name": "stderr", - "max": 128000000000000000000, + "max": 128000000000000000, "pipe": true }, - "cpuLimit": 1000000000000, - "realCpuLimit": 0, - "clockLimit": 2000000000000, + "cpuLimit": 1000000000000000000, + "realCpuLimit": 1000000000, + "clockLimit": 2000000000000000000, "memoryLimit": 134217728000000, "stackLimit": 0, "procLimit": 50,