FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix: Use a valid ShuffleStrategy for the Ray DatasetContext by YHC66 · Pull Request #6942 · feast-dev/feast · GitHub

Repository navigation

fix: Use a valid ShuffleStrategy for the Ray DatasetContext - #6942

Merged
ntkathole merged 1 commit into
feast-dev:masterfrom
YHC66:fix-ray-shuffle-strategy-enum
Oct 7, 2026
Merged

ntkathole merged 1 commit into
feast-dev:masterfrom
YHC66:fix-ray-shuffle-strategy-enum

Conversation

YHC66 commented Oct 5, 2026

Copy link
Copy Markdown
Contributor

What this PR does / why we need it:

Feast configures the Ray Data context with

ctx = DatasetContext.get_current()
ctx.shuffle_strategy = "sort"  # type: ignore

in ray_initializer.py (local, KubeRay/remote and "already initialized" paths of ensure_ray_initialized()) and in RayResourceManager.configure_ray_context().

"sort" has never been a member of ray.data.context.ShuffleStrategy (the values are sort_shuffle_pull_based, sort_shuffle_push_based, hash_shuffle, ...), which is why the # type: ignore was needed. Up to Ray 2.58 the setter stored the raw string, and since it does not equal SORT_SHUFFLE_PUSH_BASED Ray fell through to the pull-based sort shuffle.

Ray 2.59.0 (released 2026-10-02) coerces the value in the setter (self._shuffle_strategy = ShuffleStrategy(value)), so every Ray initialization in Feast now fails:

$ pip install "ray==2.59.0"
$ pytest sdk/python/tests/component/ray/test_nodes.py::test_ray_initialization_and_kuberay_modes
...
sdk/python/feast/infra/ray_initializer.py:858: in ensure_ray_initialized
    ctx.shuffle_strategy = "sort"  # type: ignore
...
E   ValueError: 'sort' is not a valid ShuffleStrategy

feast[ray] requires ray>=2.47.0 on Python 3.10, so a fresh install there already picks up 2.59.0. On 3.11+ Ray currently comes in through codeflare-sdk (which pins ray==2.58.0), so it will break as soon as that pin moves or a user installs a newer Ray.

This PR uses ShuffleStrategy.SORT_SHUFFLE_PULL_BASED instead. That is exactly what "sort" resolved to on Ray <= 2.58, so behavior does not change there, and Ray 2.59 accepts it. ShuffleStrategy exists in all Ray versions Feast supports (>= 2.47).

Tests added to sdk/python/tests/component/ray/test_resource_scheduling.py (TestShuffleStrategy) check that both RayResourceManager.configure_ray_context() and ensure_ray_initialized() leave a valid ShuffleStrategy member on the context. They fail before the fix on both Ray 2.58.0 (value is the plain string "sort") and Ray 2.59.0 (ValueError), and pass after it.

Which issue(s) this PR fixes:

No existing issue; found by running the Ray component tests against the latest Ray release.

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

Locally (macOS, Python 3.12, py3.12-ci-requirements.txt): pytest sdk/python/tests/component/ray → 75 passed with both ray==2.58.0 and ray==2.59.0 (before the fix: 1 existing failure on 2.59.0 plus the 2 new tests failing on both versions). pytest sdk/python/tests/unit -k "ray or Ray" → 66 passed, 1 skipped. ruff check / ruff format --check pass; mypy on the two changed modules reports the same single pre-existing error as on master.

Misc

YHC66 requested a review from a team as a code owner October 5, 2026 18:01

codecov-commenter commented Oct 5, 2026 •
edited
Loading

Copy link
Copy Markdown

⚠️ Please install the to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 0% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 49.31%. Comparing base (b9c65f1) to head (6f82ba8).
⚠️ Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
sdk/python/feast/infra/ray_initializer.py 0.00% 4 Missing ⚠️
...ra/offline_stores/contrib/ray_offline_store/ray.py 0.00% 2 Missing ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files

@@            Coverage Diff             @@
##           master    #6942      +/-   ##
==========================================
+ Coverage   49.06%   49.31%   +0.25%     
==========================================
  Files         435      443       +8     
  Lines       54528    55078     +550     
  Branches     7954     8015      +61     
==========================================
+ Hits        26752    27160     +408     
- Misses      25898    26032     +134     
- Partials     1878     1886       +8     
Flag Coverage Δ
go-feature-server 30.58% <ø> (ø)
python-unit 50.70% <0.00%> (+0.25%) ⬆️
Files with missing lines Coverage Δ
...ra/offline_stores/contrib/ray_offline_store/ray.py 0.00% <0.00%> (ø)
sdk/python/feast/infra/ray_initializer.py 0.00% <0.00%> (ø)

... and 12 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 b9c65f1...6f82ba8. 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.

ntkathole force-pushed the fix-ray-shuffle-strategy-enum branch from 5115dc9 to a754cfd Compare October 7, 2026 05:52
Feast set `DatasetContext.shuffle_strategy = "sort"`, which is not a
member of `ray.data.context.ShuffleStrategy`. Up to Ray 2.58 the setter
stored the raw string and Ray fell through to the pull-based sort
shuffle. Ray 2.59 coerces the value with `ShuffleStrategy(value)`, so
`ensure_ray_initialized()` and `RayResourceManager.configure_ray_context()`
now raise `ValueError: 'sort' is not a valid ShuffleStrategy`.

Use `ShuffleStrategy.SORT_SHUFFLE_PULL_BASED`, which keeps the behavior
on older Ray versions and is accepted by Ray 2.59.

Signed-off-by: Yihang Chen <yhc0720@berkeley.edu>
ntkathole force-pushed the fix-ray-shuffle-strategy-enum branch from a754cfd to 6f82ba8 Compare October 7, 2026 11:21
ntkathole merged commit 6259f5c into feast-dev:master Oct 7, 2026
18 of 23 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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


Back | FazBrowse Home | New Git URL