Skip to content

feat: Add MLflow as a first-class offline DataSource for Feast - #6702

Open
Vperiodt wants to merge 6 commits into
feast-dev:masterfrom
Vperiodt:mlflow-datasource
Open

feat: Add MLflow as a first-class offline DataSource for Feast#6702
Vperiodt wants to merge 6 commits into
feast-dev:masterfrom
Vperiodt:mlflow-datasource

Conversation

@Vperiodt

@Vperiodt Vperiodt commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Adds MlflowDatasetSource so Feast can read tabular MLflow data for offline retrieval via get_historical_features() and create_saved_dataset().

  • Dual-mode source: GenAI Dataset (dataset_name/dataset_id) and artifact (run_id + artifact_path, Parquet/CSV)
  • Offline support: DuckDB/ibis direct read, plus to_arrow() fallback for other stores
  • Auth: Bearer token propagation from Feast requests to MLflow (request context → env → ServiceAccount)
  • CLI: sync-dataset, preview-dataset, validate-source, list-sources
  • Graceful degradation when mlflow is not installed; non-MLflow FeatureViews unaffected

Which issue(s) this PR fixes:

Checks

  • I've made sure the tests are passing.
  • My commits are signed off (git commit -s)
  • My PR title follows conventional commits format

Testing Strategy

  • Unit tests
  • Integration tests
  • Manual tests
  • Testing is not required for this change

Misc

Signed-off-by: Vanshika Vanshika <vvanshik@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED
@Vperiodt
Vperiodt requested a review from a team as a code owner August 4, 2026 18:59
@codecov-commenter

codecov-commenter commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 35.17787% with 492 lines in your changes missing coverage. Please review.
✅ Project coverage is 46.74%. Comparing base (9affee5) to head (fff31c3).

Files with missing lines Patch % Lines
sdk/python/feast/cli/mlflow_cmd.py 0.00% 179 Missing ⚠️
...dk/python/feast/mlflow_integration/dataset_sync.py 41.17% 139 Missing and 31 partials ⚠️
...infra/data_sources/mlflow/mlflow_dataset_source.py 55.40% 59 Missing and 7 partials ⚠️
sdk/python/feast/infra/offline_stores/duckdb.py 6.12% 46 Missing ⚠️
sdk/python/feast/infra/data_sources/mlflow/auth.py 67.79% 15 Missing and 4 partials ⚠️
sdk/python/feast/infra/offline_stores/ibis.py 11.11% 8 Missing ⚠️
sdk/python/feast/permissions/security_manager.py 66.66% 2 Missing ⚠️
sdk/python/feast/permissions/server/arrow.py 0.00% 1 Missing ⚠️
sdk/python/feast/permissions/server/rest.py 0.00% 1 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #6702      +/-   ##
==========================================
- Coverage   46.80%   46.74%   -0.07%     
==========================================
  Files         415      420       +5     
  Lines       50397    51155     +758     
  Branches     7215     7347     +132     
==========================================
+ Hits        23589    23913     +324     
- Misses      25155    25548     +393     
- Partials     1653     1694      +41     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 48.04% <35.17%> (-0.09%) ⬇️
Files with missing lines Coverage Δ
...python/feast/infra/data_sources/mlflow/__init__.py 100.00% <100.00%> (ø)
sdk/python/feast/mlflow_integration/config.py 91.48% <100.00%> (+91.48%) ⬆️
sdk/python/feast/permissions/server/arrow.py 52.38% <0.00%> (-1.28%) ⬇️
sdk/python/feast/permissions/server/rest.py 35.29% <0.00%> (-1.07%) ⬇️
sdk/python/feast/permissions/security_manager.py 92.04% <66.66%> (-1.86%) ⬇️
sdk/python/feast/infra/offline_stores/ibis.py 38.99% <11.11%> (-1.21%) ⬇️
sdk/python/feast/infra/data_sources/mlflow/auth.py 67.79% <67.79%> (ø)
sdk/python/feast/infra/offline_stores/duckdb.py 34.65% <6.12%> (-4.62%) ⬇️
...infra/data_sources/mlflow/mlflow_dataset_source.py 55.40% <55.40%> (ø)
...dk/python/feast/mlflow_integration/dataset_sync.py 41.17% <41.17%> (ø)
... and 1 more

... and 4 files with indirect coverage changes


Continue to review full report in Codecov by Harness.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9affee5...fff31c3. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Vperiodt and others added 4 commits August 8, 2026 15:47
Signed-off-by: Vanshika Vanshika <vvanshik@redhat.com>

rh-pre-commit.version: 2.3.2
rh-pre-commit.check-secrets: ENABLED

@ntkathole ntkathole left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feature! A few concerns — mostly around thread-safety and error handling.



@contextlib.contextmanager
def mlflow_token_scope(token: Optional[str]) -> Iterator[None]:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

os.environ is process-global — concurrent requests in a multi-threaded Feast server will race over MLFLOW_TRACKING_TOKEN, potentially leaking tokens between users. Same issue applies to mlflow.set_tracking_uri() calls throughout the PR.

f"Unsupported artifact format: {self.artifact_format}"
)

def _fetch_genai_dataframe(self):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method never calls resolve_mlflow_token() or wraps in mlflow_token_scope(), so schema introspection will fail with 401 in authenticated deployments. Compare with to_arrow() which correctly handles auth.

try:
store.write_to_offline_store(feature_view_name, batch)
except Exception as e:
logger.warning(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Offline write errors are logged but NOT added to result.errors, so the watermark can still advance even when offline data is lost. Those records become unrecoverable on the next incremental sync.

assert "score" in result_df.columns
assert "category" in result_df.columns
except Exception:
pytest.skip(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catching all Exception types and calling pytest.skip means this test can never fail — any bug (AssertionError, TypeError, etc.) is silently skipped. This provides zero regression safety.

if view is None:
return None

for attr in ("stream_source", "source", "data_source"):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When FeatureView(source=MlflowDatasetSource(...)) is used, the source is stored as batch_source. This lookup checks stream_source, source, data_source but not batch_source.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants