Initial Seg Data Server Net platform

This commit is contained in:
2026-06-30 11:49:36 +08:00
commit 98abafa7cc
48 changed files with 6020 additions and 0 deletions

45
backend/app/schemas.py Normal file
View File

@@ -0,0 +1,45 @@
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