Cohorts built from dbt's rules and exported, an idempotent run command and estimate; io split by responsibility, with stored predictions moved into the registry and the ONNX check into tracking
This commit is contained in:
@@ -16,9 +16,10 @@ import pytest
|
||||
from core.governance.enums import Environment
|
||||
from mlflow import MlflowClient
|
||||
|
||||
from models.io import training
|
||||
from models.io.registry import MODEL_SHA_TAG, registry
|
||||
from models.io.training import GIT_COMMIT_ENV, GIT_COMMIT_TAG, GIT_DIRTY_TAG, TrainingRun
|
||||
from models.io import lineage
|
||||
from models.io.lineage import GIT_COMMIT_ENV, GIT_COMMIT_TAG, GIT_DIRTY_TAG, MODEL_SHA_TAG
|
||||
from models.io.registry import registry
|
||||
from models.io.tracking import TrainingRun
|
||||
|
||||
|
||||
class Constant(mlflow.pyfunc.PythonModel):
|
||||
@@ -37,7 +38,7 @@ def _train(model: Constant | None = None, scenario: str = "tamizaje") -> tuple[T
|
||||
run = TrainingRun(domain="cacu", scenario=scenario, environment=Environment.DEV)
|
||||
if model is not None:
|
||||
run.log_model(model)
|
||||
return run, run.finish(metrics={"auc": 0.7})
|
||||
return run, registry.register_run(run.finish(metrics={"auc": 0.7}))
|
||||
|
||||
|
||||
def test_a_logged_model_is_what_the_version_loads(mlflow_tracking):
|
||||
@@ -129,7 +130,7 @@ def test_an_explicit_version_is_returned_with_its_status(production_ready):
|
||||
|
||||
|
||||
def _git(*args: str) -> str:
|
||||
return subprocess.run(["git", "-C", str(Path(training.__file__).parent), *args], capture_output=True, text=True,
|
||||
return subprocess.run(["git", "-C", str(Path(lineage.__file__).parent), *args], capture_output=True, text=True,
|
||||
check=True).stdout.strip()
|
||||
|
||||
|
||||
@@ -155,7 +156,7 @@ def test_without_a_repository_the_commit_comes_from_the_environment(mlflow_track
|
||||
def no_git(*args, **kwargs):
|
||||
raise FileNotFoundError("git")
|
||||
|
||||
monkeypatch.setattr(training.subprocess, "run", no_git)
|
||||
monkeypatch.setattr(lineage.subprocess, "run", no_git)
|
||||
monkeypatch.setenv(GIT_COMMIT_ENV, "abc123")
|
||||
tags = MlflowClient().get_run(TrainingRun(domain="cacu", scenario="tamizaje",
|
||||
environment=Environment.DEV).run_id).data.tags
|
||||
|
||||
Reference in New Issue
Block a user