fix: remove optional for task.Limit
This commit is contained in:
		
							parent
							
								
									704c10e917
								
							
						
					
					
						commit
						94dc847a11
					
				|  | @ -2,7 +2,9 @@ from datetime import datetime | ||||||
| from pathlib import Path | from pathlib import Path | ||||||
| from typing import Any, Dict, List, Optional, Type | from typing import Any, Dict, List, Optional, Type | ||||||
| 
 | 
 | ||||||
|  | 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): | ||||||
|  | @ -51,10 +53,10 @@ class Files(BaseModel): | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Limit(BaseModel): | class Limit(BaseModel): | ||||||
|     mem: Optional[int] = 800 |     mem: int = humanfriendly.parse_size("128M") | ||||||
|     cpu: Optional[int] = 1000 |     cpu: int = timeparse("1s") | ||||||
|     stderr: Optional[int] = 800 |     stderr: int = humanfriendly.parse_size("128M") | ||||||
|     stdout: Optional[int] = 800 |     stdout: int = humanfriendly.parse_size("128M") | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| class Stage(BaseModel): | class Stage(BaseModel): | ||||||
|  |  | ||||||
|  | @ -115,18 +115,18 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  | @ -203,18 +203,18 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  | @ -309,13 +309,13 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  | @ -431,7 +431,7 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|  | @ -439,10 +439,10 @@ | ||||||
|                                 "max": 65000000000000, |                                 "max": 65000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  | @ -535,13 +535,13 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  | @ -625,17 +625,17 @@ | ||||||
|                             "env": [], |                             "env": [], | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 95656304705536, |                             "memoryLimit": 95656304705536, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|  |  | ||||||
|  | @ -37,13 +37,13 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  |  | ||||||
|  | @ -32,7 +32,7 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|  | @ -40,10 +40,10 @@ | ||||||
|                                 "max": 65000000000000, |                                 "max": 65000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  |  | ||||||
|  | @ -36,13 +36,13 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  |  | ||||||
|  | @ -24,17 +24,17 @@ | ||||||
|                             "env": [], |                             "env": [], | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 95656304705536, |                             "memoryLimit": 95656304705536, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|  |  | ||||||
|  | @ -30,18 +30,18 @@ | ||||||
|                             }, |                             }, | ||||||
|                             "stdout": { |                             "stdout": { | ||||||
|                                 "name": "stdout", |                                 "name": "stdout", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "stderr": { |                             "stderr": { | ||||||
|                                 "name": "stderr", |                                 "name": "stderr", | ||||||
|                                 "max": 800000000000000, |                                 "max": 128000000000000000000, | ||||||
|                                 "pipe": true |                                 "pipe": true | ||||||
|                             }, |                             }, | ||||||
|                             "cpuLimit": 1000000000000000, |                             "cpuLimit": 1000000000000, | ||||||
|                             "realCpuLimit": 0, |                             "realCpuLimit": 0, | ||||||
|                             "clockLimit": 2000000000000000, |                             "clockLimit": 2000000000000, | ||||||
|                             "memoryLimit": 838860800, |                             "memoryLimit": 134217728000000, | ||||||
|                             "stackLimit": 0, |                             "stackLimit": 0, | ||||||
|                             "procLimit": 50, |                             "procLimit": 50, | ||||||
|                             "cpuRateLimit": 0, |                             "cpuRateLimit": 0, | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	Block a user