Skip to content

Make every datagen MLflow run self-describing - #319

Open
AlexanderFengler wants to merge 2 commits into
mainfrom
feat/mlflow-run-identity
Open

Make every datagen MLflow run self-describing#319
AlexanderFengler wants to merge 2 commits into
mainfrom
feat/mlflow-run-identity

Conversation

@AlexanderFengler

Copy link
Copy Markdown
Member

What

First PR of the HSSM ecosystem's "MLflow as database of record" workstream (PR-0.1 of the plan coordinated in HSSMSpine). Every generate invocation now logs enough identity onto its MLflow run that a catalog can answer "what data is this?" without unpickling artifacts or decoding experiment-name conventions:

  • Params (immutable facts): model, generator_approach, n_files, config_sha256, ssm_simulators_version, data_output_folder
  • Tags (per-invocation): schema_version=1, phase=datagen (or datagen_dry_run), SLURM ids from env when present
  • New repeatable --mlflow-tag KEY=VALUE option so an orchestrator can stamp batch-level tags (e.g. a generation-batch id) without this repo knowing about them; reserved keys (schema_version, phase) are rejected at parse time, and parsing happens before MLflow setup so a malformed tag can't leave a junk run behind
  • generator_approach is now persisted into data_config inside the training-data pickles, so downstream consumers (LANfactory) see provenance too
  • config_sha256 is computed inside load_config (the packaged default config only exists inside the as_file context, so hashing outside it was impossible)

Ecosystem impact

Downstream: LANfactory's training runs (companion PR lnccbrown/LANfactory) log a matching schema so datagen ↔ training runs can be joined; LAN_pipeline_minimal will consume --mlflow-tag for batch stamping. No API breaks — all changes are additive.

Review provenance

This diff went through an adversarial multi-agent review before opening (12 findings across the three Phase-0 branches, all addressed or empirically refuted). Findings fixed here: junk-run-on-malformed-tag, reserved-tag overwrite, dry-run phase pollution, missing sha for the packaged default config.

Commands run

uv run pytest tests/   # 1022 passed
uv run ruff check . && uv run ruff format --check .

🤖 Generated with Claude Code

AlexanderFengler and others added 2 commits August 5, 2026 19:39
The model identity of a data-generation run was previously recoverable only
from experiment-name conventions ({model}-data-generation), which hold only
for orchestrated submissions. Downstream consumers (LANfactory training,
the network registry) need it on the run itself.

- Log identity params on every run: model, generator_approach, n_files,
  config_sha256 (of the YAML bytes), ssm_simulators_version
- Tags: schema_version=1, phase=datagen, plus slurm_job_id /
  slurm_array_job_id / slurm_array_task_id picked up from the environment
- New repeatable `--mlflow-tag KEY=VALUE` so an orchestrator can stamp e.g.
  generation_batch_id without this CLI knowing about it; caller tags win on
  collision; malformed tags fail fast even when MLflow is inactive
- Persist generator_approach into data_config: previously it only *selected*
  the config template and was dropped, so it never reached the training-data
  pickles (which embed data_config as generator_config) or any MLflow record

Schema documented in HSSMSpine _docs/mlflow-schema.md (forthcoming).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Four issues from adversarial review, each reproduced against a live store:

- Malformed --mlflow-tag left a junk empty run: parsing now happens before
  setup_mlflow starts the run, matching the fail-fast intent
- --mlflow-tag could silently overwrite schema_version/phase, making runs
  invisible to schema-filtered consumers: reserved keys now rejected at parse
- Dry runs were stamped phase=datagen with n_files=<requested> despite zero
  files: they now get phase=datagen_dry_run
- config_sha256 was omitted whenever the packaged default config drove the
  run: load_config now computes the sha itself (the default file only exists
  inside its as_file context) and returns it alongside the config

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@AlexanderFengler, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 34 minutes

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 128ab812-be10-4b83-91df-7bd9acbdd476

📥 Commits

Reviewing files that changed from the base of the PR and between e5b87eb and f8128bc.

📒 Files selected for processing (3)
  • ssms/cli/generate.py
  • tests/test_generate_cli.py
  • tests/test_mlflow_integration.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Aug 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
unittests 94.18% <100.00%> (+0.04%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
ssms/cli/generate.py 97.43% <100.00%> (+0.46%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant