512ebd13b2
- Introduced `protocol.py` for shared data models used in server/client communication, including request and response schemas for registration, job submission, and status updates. - Implemented `server.py` to manage a SQLite job queue and client registry, handling job polling, status updates, and job completion. - Created a cheat sheet for server usage, detailing commands for starting the server, submitting jobs, and monitoring clients. - Added several experiment configuration files for various training setups, including geometry vector injections and baseline ensembles.
62 lines
1.3 KiB
Python
62 lines
1.3 KiB
Python
"""Shared data models for server/client communication."""
|
|
from __future__ import annotations
|
|
|
|
from typing import Optional
|
|
from pydantic import BaseModel
|
|
|
|
|
|
class RegisterRequest(BaseModel):
|
|
hostname: str
|
|
gpu_info: str
|
|
|
|
|
|
class RegisterResponse(BaseModel):
|
|
client_id: str
|
|
|
|
|
|
class StatusPush(BaseModel):
|
|
state: str # idle | syncing | running | uploading | error
|
|
job_id: Optional[str] = None
|
|
run_name: Optional[str] = None
|
|
fold: Optional[int] = None
|
|
stage: Optional[str] = None
|
|
epoch: Optional[int] = None
|
|
total_epochs: Optional[int] = None
|
|
last_val_auc: Optional[float] = None
|
|
error: Optional[str] = None
|
|
|
|
|
|
class ClientInfo(BaseModel):
|
|
client_id: str
|
|
hostname: str
|
|
gpu_info: str
|
|
status: StatusPush
|
|
last_seen: str
|
|
|
|
|
|
class JobSpec(BaseModel):
|
|
job_id: str
|
|
run_name: str
|
|
module: str # e.g. "v4.classes.v4_hypertower"
|
|
args: list[str]
|
|
output_dir: str = "v4/results"
|
|
|
|
|
|
class PollResponse(BaseModel):
|
|
job: Optional[JobSpec] = None
|
|
please_reregister: bool = False
|
|
|
|
|
|
class JobResult(BaseModel):
|
|
job_id: str
|
|
success: bool
|
|
error_msg: Optional[str] = None
|
|
|
|
|
|
class JobSubmit(BaseModel):
|
|
run_name: str
|
|
module: str = "v4.classes.v4_hypertower"
|
|
args: list[str]
|
|
output_dir: str = "v4/results"
|
|
priority: int = 0
|