diff --git a/models/definitions.py b/models/definitions.py index 85a923e..54b443e 100644 --- a/models/definitions.py +++ b/models/definitions.py @@ -111,7 +111,7 @@ def score_models(context: dg.OpExecutionContext, config: Scoring) -> dict: found = {name: jobs.score(name) for name in config.models or jobs.JOBS.routine()} for name, version in found.items(): context.log.info(f"{name}: " + (f"version {version}" if version else "no champion")) - silver.build([getattr(jobs, "GOLD", f"{config.domain}_risk") + "+"]) + silver.build(getattr(jobs, "GOLD_SELECT", [f"{config.domain}_risk+"])) return found diff --git a/models/tea/jobs.py b/models/tea/jobs.py index a8b979d..cb125ea 100644 --- a/models/tea/jobs.py +++ b/models/tea/jobs.py @@ -20,7 +20,6 @@ from persistance import cluster, eeg, registry, silver ASSOCIATION = "ados2_association" MODELS = curves.SCENARIOS -GOLD = "tea_eeg_metrics" GOLD_SELECT = [ "tea_eeg_analyses+", "tea_eeg_metrics+", @@ -93,7 +92,7 @@ def _cohort(source: cluster.TrainingSource, as_of: date) -> tuple[str, list[dict @dataclass(frozen=True) class Jobs: def routine(self) -> list[str]: - return list(MODELS) + return [*MODELS, ASSOCIATION] JOBS = Jobs() @@ -265,6 +264,8 @@ def relate() -> int | None: def score(name: str) -> int | None: + if name == ASSOCIATION: + return relate() found = registry.champion(registered(name)) if found is None: return None diff --git a/tests/test_tea_job.py b/tests/test_tea_job.py index 6ecbca1..5ff523d 100644 --- a/tests/test_tea_job.py +++ b/tests/test_tea_job.py @@ -5,6 +5,7 @@ import pytest from pydantic import ValidationError from models.definitions import ScopeConfig, after_ingest +from models.tea.jobs import ASSOCIATION, JOBS, MODELS from persistance import eeg @@ -36,6 +37,10 @@ def test_scope_validation(): ScopeConfig(mode="first_n").model() +def test_the_domain_routine_scores_the_curves_then_relates_the_association(): + assert JOBS.routine() == [*MODELS, ASSOCIATION] + + def test_after_ingest_requests_a_run_only_with_pending_eegs(): skip = after_ingest("r1", lambda: False) assert isinstance(skip, dg.SkipReason)