Files
Seg_Data_Server_Net/backend/app/schemas.py

54 lines
1.2 KiB
Python

from __future__ import annotations
from typing import Any, Literal
from pydantic import BaseModel, Field
JobStatus = Literal["queued", "running", "success", "failed", "cancelled"]
class JobCreate(BaseModel):
type: str = Field(..., examples=["segmodel.train", "yolo.predict"])
params: dict[str, Any] = Field(default_factory=dict)
gpus: list[int] | None = None
conda_env: str | None = None
class JobRecord(BaseModel):
id: str
type: str
status: JobStatus
params: dict[str, Any]
command: list[str]
cwd: str
description: str = ""
pid: int | None = None
exit_code: int | None = None
created_at: str
started_at: str | None = None
finished_at: str | None = None
log_path: str
error: str | None = None
class ProfileCreate(BaseModel):
name: str
kind: str
data: dict[str, Any] = Field(default_factory=dict)
class WeightSyncRequest(BaseModel):
mode: Literal["copy", "reflink", "hardlink"] = "copy"
hash_files: bool = True
skip_existing: bool = True
class DatasetCreate(BaseModel):
name: str
description: str = ""
class DatasetYoloYamlRequest(BaseModel):
class_names: list[str] | None = None