dev #10
|  | @ -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" | ||||
|  |  | |||
|  | @ -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") | ||||
| 
 | ||||
|  |  | |||
|  | @ -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=( | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 | ||||
|                 task_stage.limit.cpu * 1_000_000_000_000 | ||||
|                 task_stage.limit.cpu * 1_000_000_000 | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				
					
						张泊明518370910136
						commented  is it in the correct unit? is it in the correct unit?
Give all the fields in `Limit` a default value and make it non optional in task_stage.limit 
				
					
						李衍志523370910113
						commented  resolved resolved | ||||
|                 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( | ||||
| 
					
					jon-lee marked this conversation as resolved
					
						
						
							Outdated
						
					
				 
				
					
						张泊明518370910136
						commented  The reason for the suffix in  The reason for the suffix in `keyword_parser_`? 
				
					
						李衍志523370910113
						commented  just forgot to remove, sorry just forgot to remove, sorry | ||||
|                 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, | ||||
|             ), | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
|  | @ -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, | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user
	
is there a conclusion now? or it should have a prefix
TODO:?so far works fine on 280 sides, indicating that pbs in 151 can be resolved with proper guidelines I think.
ok, then add that prefix