Governance trains TEA's EEG on a local reference folder when one is configured
This commit is contained in:
@@ -101,3 +101,17 @@ def test_an_unknown_scenario_or_job_is_a_404_and_no_manifest_is_a_503(app_client
|
||||
assert app_client.get("/governance/training-jobs/nada").status_code == 404
|
||||
monkeypatch.delenv("DBT_MANIFEST")
|
||||
assert app_client.post("/governance/model-versions/cama/survival/train-jobs").status_code == 503
|
||||
|
||||
|
||||
def test_tea_trains_on_a_local_reference_folder_when_one_is_configured(monkeypatch):
|
||||
"""Pins down: with `TEA_REFERENCE_DIR` (and its ages table) set, TEA's job passes them to `models run`, and CaMa's job
|
||||
never does. Fails if the folder is ignored, which would send the training to storage the machine cannot reach."""
|
||||
monkeypatch.setenv("DBT_MANIFEST", "m.json")
|
||||
monkeypatch.setenv("TEA_REFERENCE_DIR", "/referencia")
|
||||
monkeypatch.setenv("TEA_REFERENCE_AGES", "/referencia/edades.csv")
|
||||
|
||||
tea = training_jobs._command("tea", "eeg")
|
||||
cama = training_jobs._command("cama", "survival")
|
||||
|
||||
assert tea[tea.index("--reference-dir") + 1] == "/referencia" and tea[tea.index("--reference-ages") + 1] == "/referencia/edades.csv"
|
||||
assert "--manifest" not in tea and "--reference-dir" not in cama
|
||||
|
||||
@@ -18,7 +18,7 @@ from pathlib import Path
|
||||
|
||||
TAIL_CHARS = 4000
|
||||
# A domain whose scenarios train on a reference cohort and not on a dbt cohort build.
|
||||
OWN_STEPS = {"tea": "Entrena con la cohorte de referencia de EEG (requiere el clúster o --reference-dir)."}
|
||||
OWN_STEPS = {"tea": "Entrena con la cohorte de referencia de EEG (el clúster, o la carpeta de `TEA_REFERENCE_DIR`)."}
|
||||
|
||||
|
||||
def _models_root() -> Path:
|
||||
@@ -54,6 +54,13 @@ def _command(domain: str, scenario: str) -> list[str]:
|
||||
argv = [sys.executable, "-m", "models", "run", domain, scenario, "--environment", "prod", "--train", "--promote"]
|
||||
if domain not in OWN_STEPS:
|
||||
argv += ["--export", "--source", "dbt", "--manifest", os.environ["DBT_MANIFEST"]]
|
||||
elif domain == "tea" and os.environ.get("TEA_REFERENCE_DIR"):
|
||||
# A reference cohort on this machine's disk, instead of the configured one in the cluster's storage.
|
||||
argv += ["--reference-dir", os.environ["TEA_REFERENCE_DIR"]]
|
||||
if os.environ.get("TEA_REFERENCE_AGES"):
|
||||
argv += ["--reference-ages", os.environ["TEA_REFERENCE_AGES"]]
|
||||
if os.environ.get("TEA_REFERENCE_LINE_HZ"):
|
||||
argv += ["--line-hz", os.environ["TEA_REFERENCE_LINE_HZ"]]
|
||||
return argv
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user