fix: unit of time
This commit is contained in:
parent
94dc847a11
commit
45765e29e0
|
@ -2,7 +2,6 @@ from typing import Any, Dict, List, Optional, Union
|
||||||
|
|
||||||
import humanfriendly
|
import humanfriendly
|
||||||
from pydantic import BaseModel, Field
|
from pydantic import BaseModel, Field
|
||||||
from pytimeparse.timeparse import timeparse
|
|
||||||
|
|
||||||
|
|
||||||
class LocalFile(BaseModel):
|
class LocalFile(BaseModel):
|
||||||
|
@ -44,9 +43,9 @@ class Cmd(BaseModel):
|
||||||
stdin: Optional[Union[InputFile | StreamIn]] = None
|
stdin: Optional[Union[InputFile | StreamIn]] = None
|
||||||
stdout: Optional[Union[Collector | StreamOut]] = None
|
stdout: Optional[Union[Collector | StreamOut]] = None
|
||||||
stderr: Optional[Union[Collector | StreamOut]] = None
|
stderr: Optional[Union[Collector | StreamOut]] = None
|
||||||
cpu_limit: int = Field(0, serialization_alias="cpuLimit")
|
cpu_limit: int = Field(1_000_000_000, serialization_alias="cpuLimit")
|
||||||
real_cpu_limit: int = Field(0, serialization_alias="realCpuLimit")
|
real_cpu_limit: int = Field(1_000_000_000, serialization_alias="realCpuLimit")
|
||||||
clock_limit: int = Field(2 * timeparse("1s"), serialization_alias="clockLimit")
|
clock_limit: int = Field(2 * 1_000_000_000, serialization_alias="clockLimit")
|
||||||
memory_limit: int = Field(
|
memory_limit: int = Field(
|
||||||
humanfriendly.parse_size("128m"), serialization_alias="memoryLimit"
|
humanfriendly.parse_size("128m"), serialization_alias="memoryLimit"
|
||||||
)
|
)
|
||||||
|
@ -77,7 +76,7 @@ class OptionalCmd(BaseModel):
|
||||||
cpu_limit: Optional[int] = Field(None, serialization_alias="cpuLimit")
|
cpu_limit: Optional[int] = Field(None, serialization_alias="cpuLimit")
|
||||||
real_cpu_limit: Optional[int] = Field(None, serialization_alias="realCpuLimit")
|
real_cpu_limit: Optional[int] = Field(None, serialization_alias="realCpuLimit")
|
||||||
clock_limit: Optional[int] = Field(
|
clock_limit: Optional[int] = Field(
|
||||||
2 * timeparse("1s"), serialization_alias="clockLimit"
|
2 * 1_000_000_000, serialization_alias="clockLimit"
|
||||||
)
|
)
|
||||||
memory_limit: Optional[int] = Field(
|
memory_limit: Optional[int] = Field(
|
||||||
humanfriendly.parse_size("128m"), serialization_alias="memoryLimit"
|
humanfriendly.parse_size("128m"), serialization_alias="memoryLimit"
|
||||||
|
|
|
@ -4,7 +4,6 @@ from typing import Any, Dict, List, Optional, Type
|
||||||
|
|
||||||
import humanfriendly
|
import humanfriendly
|
||||||
from pydantic import BaseModel, Field, model_validator
|
from pydantic import BaseModel, Field, model_validator
|
||||||
from pytimeparse.timeparse import timeparse
|
|
||||||
|
|
||||||
|
|
||||||
class ParserResultDetail(BaseModel):
|
class ParserResultDetail(BaseModel):
|
||||||
|
@ -54,7 +53,7 @@ class Files(BaseModel):
|
||||||
|
|
||||||
class Limit(BaseModel):
|
class Limit(BaseModel):
|
||||||
mem: int = humanfriendly.parse_size("128M")
|
mem: int = humanfriendly.parse_size("128M")
|
||||||
cpu: int = timeparse("1s")
|
cpu: int = 1_000_000_000
|
||||||
stderr: int = humanfriendly.parse_size("128M")
|
stderr: int = humanfriendly.parse_size("128M")
|
||||||
stdout: int = humanfriendly.parse_size("128M")
|
stdout: int = humanfriendly.parse_size("128M")
|
||||||
|
|
||||||
|
|
|
@ -77,37 +77,37 @@ def get_executor_with_config(
|
||||||
copy_in_cached={file: file for file in cached},
|
copy_in_cached={file: file for file in cached},
|
||||||
copy_out_cached=file_export if file_export is not None else [],
|
copy_out_cached=file_export if file_export is not None else [],
|
||||||
cpu_limit=(
|
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
|
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=(
|
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
|
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=(
|
memory_limit=(
|
||||||
task_stage.limit.mem * 1_024 * 1_024
|
task_stage.limit.mem * 1_024 * 1_024
|
||||||
if task_stage.limit is not None and task_stage.limit.mem is not None
|
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(
|
stderr=result.Collector(
|
||||||
name="stderr",
|
name="stderr",
|
||||||
max=(
|
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
|
if task_stage.limit is not None
|
||||||
and task_stage.limit.stderr 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,
|
pipe=True,
|
||||||
),
|
),
|
||||||
stdout=result.Collector(
|
stdout=result.Collector(
|
||||||
name="stdout",
|
name="stdout",
|
||||||
max=(
|
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
|
if task_stage.limit is not None
|
||||||
and task_stage.limit.stdout 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,
|
pipe=True,
|
||||||
),
|
),
|
||||||
|
|
|
@ -18,9 +18,9 @@
|
||||||
"with": {
|
"with": {
|
||||||
"default": {
|
"default": {
|
||||||
"env": [],
|
"env": [],
|
||||||
"cpuLimit": 0,
|
"cpuLimit": 1000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 128000000,
|
"memoryLimit": 128000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
|
"-checkFileSumList=a5b63323a692d3d8b952442969649b4f823d58dae26429494f613df160710dfc,b1bbad25b830db0a77b15a033f9ca1b7ab44c1d2d05056412bd3e4421645f0bf,f6740081487ca34963a005209e2e9adfdf6f3561719af082d40fe80145e0cceb,bbeca1491c2f8364821a328a6677c0c5d59ccd60250abac3cec0887eeb9bde3e",
|
||||||
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
|
"-checkFileNameList=.gitignore,.gitattributes,.gitea/workflows/push.yaml,.gitea/workflows/release.yaml"
|
||||||
],
|
],
|
||||||
"clockLimit": 2,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 128000000,
|
"memoryLimit": 128000000,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"copyOut": [
|
"copyOut": [
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
"env": [
|
"env": [
|
||||||
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
|
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
|
||||||
],
|
],
|
||||||
"clockLimit": 2,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 128000000,
|
"memoryLimit": 128000000,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
"copyOut": [
|
"copyOut": [
|
||||||
|
@ -115,17 +115,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -203,17 +203,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -304,17 +304,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -431,17 +431,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -530,17 +530,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -625,17 +625,17 @@
|
||||||
"env": [],
|
"env": [],
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 95656304705536,
|
"memoryLimit": 95656304705536,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
@ -762,9 +762,9 @@
|
||||||
"env": [
|
"env": [
|
||||||
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
|
"LOG_FILE_PATH=/home/tt/.cache/joint-teapot-debug.log"
|
||||||
],
|
],
|
||||||
"cpuLimit": 0,
|
"cpuLimit": 1000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2,
|
"clockLimit": 2000000000,
|
||||||
"memoryLimit": 128000000,
|
"memoryLimit": 128000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
|
@ -32,17 +32,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
|
@ -32,17 +32,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
|
@ -31,17 +31,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 65000000000000,
|
"max": 65000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
|
@ -24,17 +24,17 @@
|
||||||
"env": [],
|
"env": [],
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 95656304705536,
|
"memoryLimit": 95656304705536,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
|
@ -30,17 +30,17 @@
|
||||||
},
|
},
|
||||||
"stdout": {
|
"stdout": {
|
||||||
"name": "stdout",
|
"name": "stdout",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"stderr": {
|
"stderr": {
|
||||||
"name": "stderr",
|
"name": "stderr",
|
||||||
"max": 128000000000000000000,
|
"max": 128000000000000000,
|
||||||
"pipe": true
|
"pipe": true
|
||||||
},
|
},
|
||||||
"cpuLimit": 1000000000000,
|
"cpuLimit": 1000000000000000000,
|
||||||
"realCpuLimit": 0,
|
"realCpuLimit": 1000000000,
|
||||||
"clockLimit": 2000000000000,
|
"clockLimit": 2000000000000000000,
|
||||||
"memoryLimit": 134217728000000,
|
"memoryLimit": 134217728000000,
|
||||||
"stackLimit": 0,
|
"stackLimit": 0,
|
||||||
"procLimit": 50,
|
"procLimit": 50,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user