Skip to content
N-45divPublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Pareis

Mission control for production ML — powered by DataHub's end-to-end lineage.

Most production ML failures aren't model failures — they're silent upstream data failures. A bad load leaves prices NULL, no error is thrown, and your models keep serving predictions on poisoned inputs. The warehouse team sees a failing test; the ML team sees nothing at all. Nobody connects the two.

Pareis is the bridge. It watches DataHub for real data-quality signals (failing dbt tests, incident flags), walks the lineage graph from the broken table through features to every production model, and acts: flags exposed models, blocks retraining, notifies owners — and heals its own flags when the data recovers.

Built for Build with DataHub: The Agent Hackathon — Track 3: Production ML Agents.

The loop, on real signals

break real data          →  UPDATE raw.invoice_lines SET price = NULL (53,390 rows)
dbt test fails           →  not_null_stg_invoice_lines_price: FAIL 53390
failure lands in DataHub →  datahub ingest -c ingestion/dbt.yml
pareis scan              →  finds the failing assertion on its own,
                            walks lineage → flags 2 models (column-scoped: MEDIUM), tags + notes in DataHub
pareis gate              →  NO-GO: blocks retraining (exit 2, CI-ready)
restore + tests green    →  pareis scan auto-heals: at-risk flags removed

Everything in that loop is real: real transactions, a real warehouse, real dbt tests, real MLflow models, and DataHub's official ingestion connectors. No mocked metadata.

The stack

Layer What How it reaches DataHub
Data UCI Online Retail II — 1.07M real UK retailer transactions postgres connector
Transform dbt: staging + marts with not_null/unique tests dbt connector (manifest, catalog, run results → assertions)
Models sklearn repeat_purchaser (AUC 0.78) & return_risk (AUC 0.82), MLflow-registered mlflow connector + lineage self-published by the training job
Agent Pareis — scan / sentinel / gate / card / heal reads lineage & assertions, writes tags & notes back

Mission Control

pareis ui serves a live dashboard on http://localhost:7317: model fleet with risk status, incident feed from failing assertions, one-click blast-radius assessment, retrain gates, provenance cards, and an action log of every write-back Pareis makes.

Pareis Mission Control

Mid-incident: the two live retail models flagged AT RISK with reliability badges; the four HEALTHY models below them are from the optional Meridian sandbox tour.

The same engine drives the CLI:

pareis watch              daemon: scan on an interval, respond and heal autonomously
pareis scan               find failing assertions, assess blast radius, tag & heal
pareis sentinel <table>   blast radius of an incident on one table
pareis gate <model>       10-check retrain audit — exit 0 GO / exit 2 NO-GO (CI-ready)
pareis card <model>       provenance card from live lineage (features, sources, PII, owners)
pareis evidence <model>   EU AI Act Article 10 evidence pack, regenerated from live metadata
pareis protect [models]   reliability scores, untested critical columns, generated dbt tests

Run it yourself

Prereqs: Docker, Python 3.10+.

python -m venv .venv
.venv\Scripts\python -m pip install -e ".[demo]"

# 1. DataHub + Postgres
.venv\Scripts\datahub docker quickstart
docker run -d --name pareis-postgres -e POSTGRES_PASSWORD=pareis -e POSTGRES_DB=retail -p 5433:5432 postgres:16

# 2. Real data + transforms + models
.venv\Scripts\python scripts\load_retail_data.py
.venv\Scripts\dbt run  --project-dir dbt --profiles-dir dbt
.venv\Scripts\dbt test --project-dir dbt --profiles-dir dbt
.venv\Scripts\dbt docs generate --project-dir dbt --profiles-dir dbt
.venv\Scripts\python -m datahub ingest -c ingestion/postgres.yml
.venv\Scripts\python -m datahub ingest -c ingestion/dbt.yml
.venv\Scripts\python scripts\train_models.py
.venv\Scripts\python -m datahub ingest -c ingestion/mlflow.yml
.venv\Scripts\python scripts\register_agent.py     # Pareis appears in the Agent Registry

# 3. Mission Control (and agents: copy .mcp.json.example → .mcp.json for dual-MCP)
.venv\Scripts\python -m pareis.cli ui

# 4. Break production, watch Pareis catch it
.venv\Scripts\python scripts\corrupt_data.py
.venv\Scripts\dbt test --project-dir dbt --profiles-dir dbt   # fails — as it should
.venv\Scripts\python -m datahub ingest -c ingestion/dbt.yml
.venv\Scripts\python -m pareis.cli scan                        # detect → assess → tag
.venv\Scripts\python -m pareis.cli gate repeat_purchaser       # NO-GO

# 5. Fix it, watch Pareis stand down
.venv\Scripts\python scripts\corrupt_data.py --restore
.venv\Scripts\dbt test --project-dir dbt --profiles-dir dbt
.venv\Scripts\python -m datahub ingest -c ingestion/dbt.yml
.venv\Scripts\python -m pareis.cli scan                        # auto-heal

A self-contained sandbox (no downloads, seeded metadata, clearly labeled as such) is also available for a 2-minute tour: scripts/seed_ml_stack.py, then scripts/inject_incident.py.

Pareis as an MCP server

Existing MCP lineage tooling answers point-to-point column queries — "is there a path from A.x to B.y?" between two endpoints you already know. The incident question is different: "this column just failed — what's poisoned?" We verified first-hand against OSS quickstart that point-to-point lookup returns nothing when asked from the failing column itself, because stored dbt edges attribute derived columns to the raw table and route around it. Pareis's MCP tools answer the incident form: origin re-rooting, transitive column closure, and propagation into features and models with severity —

pareis mcp          # stdio — for local agents (Claude Code, Cursor, ...)
pareis mcp --http   # stateless streamable HTTP (2026-07-28 MCP spec) on :7318

Six read-only tools: blast_radius(table, columns?), retrain_gate(model), provenance_card(model), scan_catalog(), compliance_evidence(model), protection_report(models?). Write-back stays with the CLI, CI, and Mission Control — agents get answers, humans own policy.

Dual-MCP setup (recommended)

Pareis complements — never replaces — DataHub's official MCP server: the official server gives an agent generic catalog powers (search, entities, lineage, documents), Pareis adds the production-ML incident semantics on top:

official mcp-server-datahub   search · get_entities · get_lineage · documents
            ↓ context
pareis mcp                    scan · blast radius · contamination · gate · protect · evidence
claude mcp add datahub -e DATAHUB_GMS_URL=http://localhost:8080 -- uvx mcp-server-datahub@latest
claude mcp add pareis -- python -m pareis.mcp_server

The guardian appears inside the graph it guards

python scripts/register_agent.py registers Pareis in DataHub's Agent Registry: an aiAgent entity with its six tools as API entities, its runbook as an Agent Skill, and lineage to the models it protects and the datasets it reads. Browse urn:li:aiAgent:pareis in the catalog — metadata about the agent, in the metadata graph.

Claude Code registration:

claude mcp add pareis -- python -m pareis.mcp_server

How it works

Full system design — graph model, algorithms, incident lifecycle and module map, with diagrams: ARCHITECTURE.md

  • Sentinel — BFS over DataHub's lineage graph: dataset → downstream datasets → DerivedFrom features → Consumes models, reconstructing every propagation path and scoring severity by feature exposure.
  • Column precision — a failing test names its column; Pareis traces it to origin columns and forward through dbt's fine-grained lineage, so only features that consume a poisoned column are flagged. The price incident flags 2/6 features MEDIUM instead of 6/6 HIGH — with the failed row count (53,455) attached from the assertion run.
  • Lineage-drift detection — training-serving skew is the most damaging silent ML failure, and it starts as a graph change: the transformation feeding a feature gets edited after the model trained on it. The training job records a fingerprint of the full feature-lineage shape; the gate compares it against the live graph and warns the moment they diverge — before the silent weeks of wrong predictions.
  • Compliance evidence — pareis evidence <model> generates an EU AI Act Article 10 data-governance evidence pack (provenance, quality-monitoring status, all 10 gate controls, training-run traceability) from the live metadata graph. Article 10 obligations for high-risk AI systems generally apply from 2 August 2026 (transitional timelines vary by system class); hand-assembled evidence goes stale the day it ships — metadata-derived evidence never does (sample).
  • Connectors — incidents land where engineers work: Slack (PAREIS_SLACK_WEBHOOK), Jira (PAREIS_JIRA_URL/_EMAIL/_TOKEN/_PROJECT — creates a ticket), Linear (PAREIS_LINEAR_API_KEY/_TEAM — creates an issue), or any JSON sink (PAREIS_WEBHOOK_URL). Stateful: one ticket per incident regardless of how often watch sweeps, a resolution comment when Pareis heals, and ticket links written back into the DataHub notes. All optional; missing config just skips.
  • CI — pareis gate's exit codes drop into CI as a retrain-blocking step (example workflow).
  • Gate — resolves a model's features to source tables, closes over the full upstream graph, and runs 10 checks: feature resolution, upstream incidents, failing assertions, deprecation, risk flags, PII exposure, ownership coverage, feedback loops, lineage drift, staleness.
  • Write-back — tags (pareis-at-risk), institutional-memory notes, and markdown incident reports, all into DataHub where the next engineer will actually look.
  • Blind-window contamination & rollback advice — every incident has a gap between when corruption began (bounded by the last green assertion run) and when it was detected (the first red one). A model retrained inside that blind window is silently poisoned forever — healing the data does not heal the model. Pareis bounds the window from assertion run history, cross-references every registry version's training timestamp against it, issues CONTAMINATED / CLEAN verdicts, and names the newest pre-window version as the safe serving candidate. No other failure mode in production ML is this quiet; no other tool answers "which version do we roll back to?"
  • Heal — any at-risk model whose upstream graph is clean again gets its flag removed on the next scan. Pareis converges to the truth; it never cries wolf. Contaminated model versions stay flagged in the postmortem — data heals, weights don't.
  • Prevention: pareis protect & reliability scores — Pareis reacts to failing tests, which means it's blind wherever tests don't exist. protect inverts the incident machinery: every model gets a transparent Data Reliability Score (0–100: assertion coverage of its critical columns ×40, incident history ×20, ownership, lineage drift, feedback loops, staleness — every component printed, no black box), every untested critical column is ranked by production-model exposure, and the top gaps ship as a paste-ready dbt schema.yml patch. Resolved incidents are kept as structured history, so gaps that share a blast pattern with something that already burned you are flagged "same pattern as your last incident." Scores land in DataHub as typed structured properties (io.pareis.reliability_score, io.pareis.incident_count, io.pareis.last_incident) — the catalog itself becomes filterable by risk.
  • Native DataHub incidents & searchable postmortems — detection raises a real DataHub Incident on the source dataset (visible in DataHub's own UI, queryable by any agent) and resolves it automatically when assertions go green; every postmortem is also published as a DataHub Document linked to the dataset, so the next agent can ask "has this failed before, and what was the fix?" through the official MCP's document search. Institutional memory that outlives the incident.
  • Machine-readable gate — pareis gate <model> --json emits the verdict + all 10 checks for pipelines, and every gate run records io.pareis.retrain_status / io.pareis.checked_at structured properties on the model — the last decision lives in the catalog, not in a log.
  • Auto-postmortems — the 2026 incident doctrine says treat AI incidents as data incidents and postmortem them at the data layer. Pareis holds every fact that document needs, so when an incident heals it writes the postmortem itself: detection→resolution timeline with time-to-heal, failure classification (value / integrity / structural / freshness), blast radius, actions taken, tickets — attached to the dataset in DataHub and dropped in reports/.

License

Apache 2.0 — see LICENSE. Sample reports in examples/.

Dataset attribution

The demo trains on the Online Retail II dataset: Chen, D. (2012). Online Retail II [Dataset]. UCI Machine Learning Repository. https://doi.org/10.24432/C5CG6D — licensed CC BY 4.0. Real transactions from a UK-based online retailer, 2009–2011, used unmodified except for the deliberate, reversible corruption the demo performs.

Upstream contributions

Building Pareis surfaced a silent failure in DataHub's dbt ingestion: with include_column_lineage enabled, a manifest written by dbt test drops all column lineage without warning — and overwrites fine-grained lineage from earlier good runs. Fixed upstream with a verified repro: datahub#18823.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages