The notebook runner moves to reports/: experiment, notebook_jobs and notebook_import next to rendering and eda

They run a notebook on a build's file and keep it as an MLflow run, as eda does; io/ keeps the storage and MLflow
boundary and pipelines/ the cohort pipelines. Moved whole with git mv, imports repointed; models.notebook, the API
notebooks import, stays where it is.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
This commit is contained in:
2026-11-19 20:50:46 -06:00
parent dce29670a4
commit 01e4406838
9 changed files with 26 additions and 23 deletions
+2 -2
View File
@@ -137,11 +137,11 @@ def _report_eda(args: argparse.Namespace) -> int:
def _serve_notebooks(args: argparse.Namespace) -> int:
"""The runner container's loop (`models.io.notebook_jobs.serve`)."""
"""The runner container's loop (`models.reports.notebook_jobs.serve`)."""
import os
from pathlib import Path
from models.io.notebook_jobs import JOBS_DIR_ENV, serve
from models.reports.notebook_jobs import JOBS_DIR_ENV, serve
folder = args.jobs or os.environ.get(JOBS_DIR_ENV)
if not folder:
+2 -2
View File
@@ -1,4 +1,4 @@
"""What a notebook run from the platform works with (`models.pipelines.experiment`): the cohort build's file it was
"""What a notebook run from the platform works with (`models.reports.experiment`): the cohort build's file it was
run on and, if one was chosen, a registered model version.
from models.notebook import experiment
@@ -62,7 +62,7 @@ class Experiment:
def training_run(self, scenario: str | None = None):
"""A DEV run of this domain, linked to the build's file. On the platform it goes to the job's own MLflow and
is copied into the real one, as DEV, when the notebook ends (`models.io.notebook_import`)."""
is copied into the real one, as DEV, when the notebook ends (`models.reports.notebook_import`)."""
from models.io.storage import cohort_reference, file_sha256
from models.io.tracking import TrainingRun
+7 -4
View File
@@ -1,6 +1,9 @@
"""Reports: notebooks run on a build's file, rendered with Quarto and kept in MLflow, using `models.io` to read the
build and record the run.
"""Reports: notebooks run on a build's file, rendered and kept in MLflow, using `models.io` to read the build and record
the run.
rendering.py a notebook to a self-contained HTML page with Quarto, and what identifies its content
eda.py the exploratory notebook of a scenario, as a report run
rendering.py a notebook to a self-contained HTML page (Quarto or Jupyter), and what identifies its content
eda.py the exploratory notebook of a scenario, as a report run
experiment.py a notebook uploaded to the platform, run on a build's file as a run of `<domain>-<scenario>/experimentos`
notebook_jobs.py where that notebook runs: its job folder and the executors (local, or the runner container)
notebook_import.py what the notebook trained in its own store, copied into the platform's MLflow as DEV
"""
@@ -7,9 +7,9 @@ the page with its outputs (`report/`), what was imported from it (`importado.jso
`error.txt`. `start` creates the run; `execute` runs the notebook through an executor and closes the run, so a caller
can run it in the background and hand out the run's id at once.
The notebook runs in a job folder of its own (`models.io.notebook_jobs`) with the build's file as its only data and
The notebook runs in a job folder of its own (`models.reports.notebook_jobs`) with the build's file as its only data and
an MLflow store of its own; what it trained is copied into the platform's MLflow as DEV afterwards
(`models.io.notebook_import`). Where it runs is the executor's: the runner container, with no network and no view
(`models.reports.notebook_import`). Where it runs is the executor's: the runner container, with no network and no view
of the server's files, or this process for development.
"""
@@ -27,8 +27,8 @@ from mlflow.entities import RunStatus
from models.io.lineage import COHORT_BUILD_TAG, COHORT_SOURCE_TAG, COHORT_URL_TAG, DOMAINS, code_version, \
registered_name
from models.io.notebook_import import import_job
from models.io.notebook_jobs import JOB_TIMEOUT, JOB_TIMEOUT_ENV, PAGE_FILE, executor, prepare_job, read_job_file, \
from models.reports.notebook_import import import_job
from models.reports.notebook_jobs import JOB_TIMEOUT, JOB_TIMEOUT_ENV, PAGE_FILE, executor, prepare_job, read_job_file, \
result_of
from models.io.storage import cohort_reference, file_sha256, read_metadata
from models.io.tracking import MODEL_PATH, experiment_id, run_file, run_files
@@ -20,7 +20,7 @@ from mlflow import MlflowClient
from mlflow.entities import Metric, Param
from models.io.lineage import MODEL_SHA_TAG, code_version, model_sha
from models.io.notebook_jobs import STORE_FILE, JobError, inside, read_job_file
from models.reports.notebook_jobs import STORE_FILE, JobError, inside, read_job_file
from models.io.tracking import MODEL_PATH, experiment_id
NOTEBOOK_RUN_TAG = "notebook.run_id"
@@ -5,7 +5,7 @@ A job is one folder named after the notebook's run, holding everything the noteb
(`model/`) and `job.json`. The notebook runs with that folder as its world: its MLflow is a throwaway store inside it
(`mlflow.db`, `artefactos/`), and every database URL is an empty in-memory database. The runner writes the page
(`page.html`) and `result.json`; what the notebook trained is imported afterwards by trusted code
(`models.io.notebook_import`).
(`models.reports.notebook_import`).
Executors are classes in `EXECUTORS`: `local` runs the job in this process, unsandboxed, for development;
`contenedor` leaves it in `NOTEBOOK_JOBS_DIR` for the runner container (`python -m models notebooks serve`), which