Repository navigation
Fix 31889: Extract MLflow 3.x model signatures and paginate the registry listing - #32024
Conversation
MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised KeyError on every model. The broad except swallowed it, leaving mlFeatures empty and emitting a spurious warning per model. No metadata API exposes the signature -- not the MLflow logged-model endpoint, nor either Unity Catalog model-version endpoint -- so it can only be read from the model's own MLmodel file. Fetch just that one file. `mlflow.models.get_model_info` is deliberately avoided: it resolves `models:/` URIs through MLflow's global tracking config, which this connector never sets, and it imports pandas, which mlflow-skinny does not ship. Both make it fail on Unity Catalog. Resolving the artifact location through the connector's own client and parsing the YAML with json avoids each. `mlflow.artifacts.load_text` would be tidier but takes no tracking_uri, so it hits the same global-config problem. A missing tag now logs at debug rather than warning, since it is the norm on 3.x, and a tag with no entry for the run falls through to the artifacts instead of returning early. Co-Authored-By: Claude Opus 5 <[email protected]>
✅ PR checks passedThe linked issue has a description and all required Shipping project fields set. Thanks! |
Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and the topology runner drops the entity without recording a failure, so the model vanished silently. Also skip deletion reconciliation when the registry listing was truncated, since models beyond the page budget would be wrongly marked deleted. Co-Authored-By: Claude Opus 5 <[email protected]>
✅ Playwright Results — workflow succeededValidated commit ✅ 109 passed · ❌ 0 failed · 🟡 1 flaky · ⏭️ 0 skipped · 🧰 0 lifecycle flaky PerformanceBlocking targets: ✅ met · Optimization targets: 🟡 in progress Shard-job maxima below are not the full workflow wall time; the linked run includes build, fixture, planning, and reporting. 🕒 Full workflow signal wall (to summary) 46m 53s ⏱️ Max setup 7m 14s · max shard execution 16m 12s · max shard-job elapsed before upload 23m 16s · reporting 7s 🌐 216.29 requests/attempt · 1.81 app boots/UI scenario · 0.00% common-shard skew Optimization targets still in progress:
🟡 1 flaky test(s) (passed on retry)
How to debug locally# Download playwright-test-results-<shard> artifact and unzip
npx playwright show-trace path/to/trace.zip # view trace |
Track listing completion positively instead of tracking truncation, and reset it per run, so an abandoned, failed or never-started listing fails closed rather than licensing soft-deletes. Also skip reconciliation when the registry listed no models at all -- a wrong `registryUri` or credentials that cannot list are indistinguishable from an emptied registry, and acting on it deletes every model under the service.
The reporter's registry answered the first page with a token and no `registered_models` at all. The old single-call listing read that as an empty registry and reported a fully successful run over zero models.
Code Review ✅ Approved 1 resolved / 1 findingsAdds pagination support for MLflow registry listings and model signature extraction for MLflow 3.x, addressing the malformed signature payload finding. No issues found. ✅ 1 resolved✅ Edge Case: Malformed signature payload can silently drop the whole model
OptionsDisplay: compact → Showing less information. Comment with these commands to change the behavior for this request:
Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source |
|
* fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised KeyError on every model. The broad except swallowed it, leaving mlFeatures empty and emitting a spurious warning per model. No metadata API exposes the signature -- not the MLflow logged-model endpoint, nor either Unity Catalog model-version endpoint -- so it can only be read from the model's own MLmodel file. Fetch just that one file. `mlflow.models.get_model_info` is deliberately avoided: it resolves `models:/` URIs through MLflow's global tracking config, which this connector never sets, and it imports pandas, which mlflow-skinny does not ship. Both make it fail on Unity Catalog. Resolving the artifact location through the connector's own client and parsing the YAML with json avoids each. `mlflow.artifacts.load_text` would be tidier but takes no tracking_uri, so it hits the same global-config problem. A missing tag now logs at debug rather than warning, since it is the norm on 3.x, and a tag with no entry for the run falls through to the artifacts instead of returning early. Co-Authored-By: Claude Opus 5 <[email protected]> (cherry picked from commit 1ab63cd) * fix(mlflow): stop a bad signature or partial listing from losing models Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and the topology runner drops the entity without recording a failure, so the model vanished silently. Also skip deletion reconciliation when the registry listing was truncated, since models beyond the page budget would be wrongly marked deleted. Co-Authored-By: Claude Opus 5 <[email protected]> (cherry picked from commit 8931369) * fix(mlflow): never reconcile deletions off a listing we cannot trust Track listing completion positively instead of tracking truncation, and reset it per run, so an abandoned, failed or never-started listing fails closed rather than licensing soft-deletes. Also skip reconciliation when the registry listed no models at all -- a wrong `registryUri` or credentials that cannot list are indistinguishable from an emptied registry, and acting on it deletes every model under the service. Adds the regression test for the reporter's registry shape: an empty first page that still carries a page token, which the old single-call listing read as "no models" and reported as a fully successful run. --------- Co-authored-by: Claude Opus 5 <[email protected]>
…try listing (#32024) (#32093) * fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised KeyError on every model. The broad except swallowed it, leaving mlFeatures empty and emitting a spurious warning per model. No metadata API exposes the signature -- not the MLflow logged-model endpoint, nor either Unity Catalog model-version endpoint -- so it can only be read from the model's own MLmodel file. Fetch just that one file. `mlflow.models.get_model_info` is deliberately avoided: it resolves `models:/` URIs through MLflow's global tracking config, which this connector never sets, and it imports pandas, which mlflow-skinny does not ship. Both make it fail on Unity Catalog. Resolving the artifact location through the connector's own client and parsing the YAML with json avoids each. `mlflow.artifacts.load_text` would be tidier but takes no tracking_uri, so it hits the same global-config problem. A missing tag now logs at debug rather than warning, since it is the norm on 3.x, and a tag with no entry for the run falls through to the artifacts instead of returning early. * fix(mlflow): stop a bad signature or partial listing from losing models Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and the topology runner drops the entity without recording a failure, so the model vanished silently. Also skip deletion reconciliation when the registry listing was truncated, since models beyond the page budget would be wrongly marked deleted. * fix(mlflow): never reconcile deletions off a listing we cannot trust Track listing completion positively instead of tracking truncation, and reset it per run, so an abandoned, failed or never-started listing fails closed rather than licensing soft-deletes. Also skip reconciliation when the registry listed no models at all -- a wrong `registryUri` or credentials that cannot list are indistinguishable from an emptied registry, and acting on it deletes every model under the service. * test(mlflow): cover an empty registry page that still carries a token The reporter's registry answered the first page with a token and no `registered_models` at all. The old single-call listing read that as an empty registry and reported a fully successful run over zero models. --------- Co-authored-by: Claude Opus 5 <[email protected]>
* fix(mlflow): read model signatures from the MLmodel file on MLflow 3.x MLflow 3.x dropped the `mlflow.log-model.history` run tag in favour of LoggedModel entities, so `data.tags["mlflow.log-model.history"]` raised KeyError on every model. The broad except swallowed it, leaving mlFeatures empty and emitting a spurious warning per model. No metadata API exposes the signature -- not the MLflow logged-model endpoint, nor either Unity Catalog model-version endpoint -- so it can only be read from the model's own MLmodel file. Fetch just that one file. `mlflow.models.get_model_info` is deliberately avoided: it resolves `models:/` URIs through MLflow's global tracking config, which this connector never sets, and it imports pandas, which mlflow-skinny does not ship. Both make it fail on Unity Catalog. Resolving the artifact location through the connector's own client and parsing the YAML with json avoids each. `mlflow.artifacts.load_text` would be tidier but takes no tracking_uri, so it hits the same global-config problem. A missing tag now logs at debug rather than warning, since it is the norm on 3.x, and a tag with no entry for the run falls through to the artifacts instead of returning early. (cherry picked from commit 1ab63cd) * fix(mlflow): stop a bad signature or partial listing from losing models Guard the ML-feature build: a malformed signature escaped yield_mlmodel, and the topology runner drops the entity without recording a failure, so the model vanished silently. Also skip deletion reconciliation when the registry listing was truncated, since models beyond the page budget would be wrongly marked deleted. (cherry picked from commit 8931369) * fix(mlflow): never reconcile deletions off a listing we cannot trust Track listing completion positively instead of tracking truncation, and reset it per run, so an abandoned, failed or never-started listing fails closed rather than licensing soft-deletes. Also skip reconciliation when the registry listed no models at all -- a wrong `registryUri` or credentials that cannot list are indistinguishable from an emptied registry, and acting on it deletes every model under the service. Adds the regression test for the reporter's registry shape: an empty first page that still carries a page token, which the old single-call listing read as "no models" and reported as a fully successful run. --------- Co-authored-by: Claude Opus 5 <[email protected]>



Describe your changes:
Fixes #31889
I fixed MLflow 3.x model-signature extraction, and two adjacent defects the
investigation surfaced in the same method, because all three made a broken
Unity Catalog ingestion look like a successful one.
mlFeatureswas never populated on MLflow 3.x. The connector read themlflow.log-model.historyrun tag, which MLflow 3.x removed in favour ofLoggedModel entities. The resulting
KeyErrorwas swallowed by a broadexcept, so every model ingested with empty features plus a spuriouswarning.
search_registered_modelsreturns one bounded page; the connector called it once and dropped the rest
silently.
produced zero records, no warnings, and
Success %: 100.0.Manual testing
Type of change:
High-level design:
Where the signature lives. No metadata API exposes it. I checked all three
candidates against a real Unity Catalog registry:
/api/2.0/mlflow/logged-models/{id}/api/2.0/mlflow/unity-catalog/model-versions/get/api/2.1/unity-catalog/models/{name}/versions/{v}MLflow 3 keeps it only in the model's
MLmodelmetadata file, so it has to beread from the artifact store. Just that one file is fetched — never the weights —
and MLflow's progress bar is suppressed so it stays out of the ingestion logs.
Why not
mlflow.models.get_model_info(the approach in #31920): it resolvesmodels:/URIs through MLflow's global tracking config, which this connectornever sets — it only passes URIs to the
MlflowClientconstructor. Against UnityCatalog it therefore resolves against a local default store and dies with
ModuleNotFoundError: alembic. Forcing the globals gets one step further and thenfails on
ModuleNotFoundError: pandas, whichmlflow-skinnydoes not ship andthe
mlflowextra does not add. Instead the artifact location is resolved throughthe connector's own client (
get_logged_model(...).artifact_locationfor amodels:/source) and the YAML parsed withjson— no global state, no pandas.mlflow.artifacts.load_textwould be tidier but its signature isload_text(artifact_uri)with notracking_uri, so it hits the sameglobal-config problem.
download_artifacts(..., tracking_uri=...)is used instead.Backward compatibility. The MLflow 2.x tag is still tried first and short-
circuits without any artifact call, so 2.x behaviour is unchanged. The artifact
read happens only when the tag is absent or carries no entry for the run.
Cost. One extra round trip per model, only on the fallback path, and only for
models that resolved a version — so
system.ai.*foundation models, which have norun-backed versions, pay nothing.
Tests:
Use cases covered
mlFeatures, withstringmapped to categorical and numeric types to numericalmodels:/<model_id>source is resolved through the registry; a direct artifact source is used as-isyield_mlmodelcarries the resolved features onto theCreateMlModelRequestUnit tests
ingestion/tests/unit/source/mlmodel/mlflow/test_metadata.py(+22 tests, 34 total)metadata/ingestion/source/mlmodel/mlflow/metadata.py(201 statements, 19 missed). Every added or changed line is covered; the
remainder is pre-existing untested code —
create()and the exceptionbranches of
_get_hyper_params/_get_ml_store— which this PR does not touch.Backend integration tests
Ingestion integration tests
which cannot reproduce the Unity Catalog path (OSS populates
latest_versionsand its
sourceis a directly-readable artifact URI, so both defects arehidden). Verified manually against real Unity Catalog instead — steps below.
Playwright (UI) tests
Manual testing performed
Against a real Databricks Unity Catalog registry (
trackingUri: databricks,registryUri: databricks-uc) and a local OpenMetadata server, ingesting aUC-registered model with a 3-column signature:
demo.om_connector_test.sales_forecastviamlflow.pyfunc.log_modelwith signature
store_id:string, week_of_year:long, prior_sales:double.metadata ingestbefore the fix — the model ingested withmlFeatures: EMPTYand 2 warnings (
Cannot extract properties from RunData: 'mlflow.log-model.history').mlFeatures: [(store_id, categorical), (week_of_year, numerical), (prior_sales, numerical)],Warnings: 0,Errors: 0,Success 100%. Confirmed viaGET /api/v1/mlmodels?service=...&fields=mlFeaturesand in the UI.Listed 88 registered model(s) from the MLflow registry over 2 page(s)— it nowfollows the token instead of stopping at page 1.
local MLflow registry (Docker, mlflow 3.14.0), which previously reported
Success %: 100.0with no indication.mlflow-skinny3.10.1 and3.14.0 — with identical results.
UI screen recording / screenshots:
Not applicable.
Checklist:
Fixes <issue-number>: <short explanation>Fixes #<issue-number>above.(
test_features_read_from_mlmodel_when_the_tag_is_absent, which returnsNoneagainst the current code — see MLflow connector fails to extract features on MLflow 3.x due to removed mlflow.log-model.history tag #31889).Greptile Summary
The PR adds MLflow 3.x signature extraction from MLmodel artifacts, paginates registered-model discovery, and adds conservative deletion checks for incomplete or empty registry listings.
Confidence Score: 4/5
The PR is not yet safe to merge because a transient per-model processing failure can still cause a valid OpenMetadata model to be soft-deleted.
Registry pagination can complete successfully while version or run processing drops an individual model before it enters mlmodel_source_state, after which deletion reconciliation treats that missing model as stale.
Files Needing Attention: ingestion/src/metadata/ingestion/source/mlmodel/mlflow/metadata.py
Important Files Changed
Flowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[Paginate MLflow registry] --> B{Terminal page reached?} B -- No --> C[Skip deletion reconciliation] B -- Yes --> D[Process each listed model] D --> E{Version and run processing succeeds?} E -- Yes --> F[Add model FQN to source state] E -- No --> G[Model absent from source state] F --> H[Run deletion reconciliation] G --> H H --> I[Unrecorded existing models are soft-deleted]Reviews (4): Last reviewed commit: "test(mlflow): cover an empty registry pa..." | Re-trigger Greptile
Context used: