feat: only support str limit in toml
This commit is contained in:
parent
719f19232b
commit
d6a33d2f20
|
@ -60,20 +60,24 @@ class Files(BaseModel):
|
||||||
class Limit(BaseModel):
|
class Limit(BaseModel):
|
||||||
mem: int = DEFAULT_MEMORY_LIMIT
|
mem: int = DEFAULT_MEMORY_LIMIT
|
||||||
cpu: int = DEFAULT_CPU_LIMIT
|
cpu: int = DEFAULT_CPU_LIMIT
|
||||||
stderr: int = DEFAULT_FILE_LIMIT
|
|
||||||
stdout: int = DEFAULT_FILE_LIMIT
|
stdout: int = DEFAULT_FILE_LIMIT
|
||||||
|
stderr: int = DEFAULT_FILE_LIMIT
|
||||||
|
|
||||||
model_config = ConfigDict(validate_assignment=True)
|
model_config = ConfigDict(validate_assignment=True)
|
||||||
|
|
||||||
@field_validator("cpu", mode="before")
|
@field_validator("cpu", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def ensure_time(cls, v: Any) -> Time:
|
def ensure_time(cls, v: Any) -> Time:
|
||||||
return Time(v)
|
if isinstance(v, str):
|
||||||
|
return Time(v)
|
||||||
|
raise ValueError("Must be a string")
|
||||||
|
|
||||||
@field_validator("mem", "stdout", "stderr", mode="before")
|
@field_validator("mem", "stdout", "stderr", mode="before")
|
||||||
@classmethod
|
@classmethod
|
||||||
def ensure_mem(cls, v: Any) -> Memory:
|
def ensure_mem(cls, v: Any) -> Memory:
|
||||||
return Memory(v)
|
if isinstance(v, str):
|
||||||
|
return Memory(v)
|
||||||
|
raise ValueError("Must be a string")
|
||||||
|
|
||||||
|
|
||||||
class Stage(BaseModel):
|
class Stage(BaseModel):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user