TEA gate, EEG pages, analyze and named training runs

This commit is contained in:
Roberto Treviño
2026-11-26 07:06:52 -06:00
parent 26cf994d1a
commit cb9115c435
4 changed files with 283 additions and 2 deletions
+11 -1
View File
@@ -75,6 +75,7 @@ def promote(domain: Domain, name: str, version: int) -> dict:
class Training(BaseModel):
as_of: date | None = None # the date the data are taken up to (default: today)
models: list[str] = [] # which (default: all but the slow ones, like CaMa's recurrence)
def _submit(client: DagsterGraphQLClient, job: str, op: str, config: dict) -> dict[str, str]:
@@ -89,12 +90,21 @@ def _submit(client: DagsterGraphQLClient, job: str, op: str, config: dict) -> di
def train(domain: Domain, request: Training,
client: DagsterGraphQLClient = Depends(dagster)) -> dict[str, str]: # fmt: skip
"""Starts training a new version of every model of the domain; follow it at /runs."""
config = {"domain": domain.value}
config: dict = {"domain": domain.value}
if request.as_of:
config["as_of"] = request.as_of.isoformat()
if request.models:
config["models"] = request.models
return _submit(client, "train", "train_models", config)
@router.post("/{domain}/analyze")
def analyze(domain: Domain, client: DagsterGraphQLClient = Depends(dagster)) -> dict[str, str]:
"""Starts analysing the studies the domain's models read whole (TEA: its EEGs); follow
it at /runs."""
return _submit(client, "analyze", "analyze_studies", {"domain": domain.value})
@router.post("/{domain}/score")
def score(domain: Domain, client: DagsterGraphQLClient = Depends(dagster)) -> dict[str, str]:
"""Starts a risk batch from each model's champion; follow it at /runs."""