A model whose cohort is empty at a site is skipped, not a failed train run
This commit is contained in:
@@ -6,6 +6,7 @@ from datetime import date
|
||||
import dagster as dg
|
||||
|
||||
from models import graph
|
||||
from models.jobs import EmptyCohort
|
||||
from persistance import config_log, silver
|
||||
|
||||
WRITES = {"writes": "platform"} # dagster.yaml lets one run with this tag at a time (SQLite)
|
||||
@@ -51,7 +52,12 @@ def train_models(context: dg.OpExecutionContext, config: Training) -> dict:
|
||||
as_of = date.fromisoformat(config.as_of) if config.as_of else None
|
||||
found = {}
|
||||
for name in config.models or jobs.JOBS.routine():
|
||||
found[name] = jobs.train(name, as_of)
|
||||
try:
|
||||
found[name] = jobs.train(name, as_of)
|
||||
except EmptyCohort as e: # the site has no such patients; the others still train
|
||||
found[name] = None
|
||||
context.log.warning(f"{e}: not trained")
|
||||
continue
|
||||
context.log.info(f"{config.domain}.{name}: version {found[name]}")
|
||||
return found
|
||||
|
||||
|
||||
Reference in New Issue
Block a user