Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Serve] router cast replicas set to list for random sample in python 3.11 #37809

Merged

Conversation

GeneDer
Copy link
Contributor

@GeneDer GeneDer commented Jul 26, 2023

Why are these changes needed?

Python 3.11 has a breaking change enforcing the type of random.sample() to be a list. Cast the candidate_replica_ids to list before feeding into the function.

Related issue number

Closes #37765

Checks

  • I've signed off every commit(by using the -s flag, i.e., git commit -s) in this PR.
  • I've run scripts/format.sh to lint the changes in this PR.
  • I've included any doc changes needed for https://docs.ray.io/en/master/.
    • I've added any new APIs to the API Reference. For example, if I added a
      method in Tune, I've added it in doc/source/tune/api/ under the
      corresponding .rst file.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, see the recent failures at https://flakey-tests.ray.io/
  • Testing Strategy
    • Unit tests
    • Release tests
    • This PR is not tested :(

@GeneDer GeneDer requested a review from edoakes July 26, 2023 16:21
Copy link
Contributor

@edoakes edoakes left a comment

Choose a reason for hiding this comment

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

are you testing on 3.11? 🤔

@edoakes edoakes merged commit 945304e into ray-project:master Jul 26, 2023
2 checks passed
@GeneDer
Copy link
Contributor Author

GeneDer commented Jul 26, 2023

oh no haha, this came from a user who tried serve on experimental python 3.11 #37765 I just thought it's a quick patch so go ahead and raised the PR 🙂

@GeneDer GeneDer deleted the fix-proxy-random-sample-python-3-11 branch July 26, 2023 17:09
@ddelange
Copy link
Contributor

ddelange commented Aug 14, 2023

@edoakes could you cherry-pick this one?

on ray 2.6.2:

  File "/Users/ddelange/.pyenv/versions/3.11.0/envs/vv311/lib/python3.11/site-packages/ray/serve/_private/router.py", line 404, in choose_two_replicas_with_backoff
    chosen_ids = random.sample(
                 ^^^^^^^^^^^^^^
  File "/Users/ddelange/.pyenv/versions/3.11.0/lib/python3.11/random.py", line 436, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

@ddelange ddelange mentioned this pull request Aug 14, 2023
9 tasks
@edoakes
Copy link
Contributor

edoakes commented Aug 15, 2023

@ddelange unfortunately 2.6.3 has sailed and that's the last patch release before 2.7

Hopefully we start testing python 3.11 soon...

NripeshN pushed a commit to NripeshN/ray that referenced this pull request Aug 15, 2023
…3.11 (ray-project#37809)

Python 3.11 has a breaking change enforcing the type of `random.sample()` to be a list. Cast the `candidate_replica_ids` to list before feeding into the function.

Signed-off-by: NripeshN <[email protected]>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…3.11 (ray-project#37809)

Python 3.11 has a breaking change enforcing the type of `random.sample()` to be a list. Cast the `candidate_replica_ids` to list before feeding into the function.

Signed-off-by: harborn <[email protected]>
harborn pushed a commit to harborn/ray that referenced this pull request Aug 17, 2023
…3.11 (ray-project#37809)

Python 3.11 has a breaking change enforcing the type of `random.sample()` to be a list. Cast the `candidate_replica_ids` to list before feeding into the function.
@ddelange
Copy link
Contributor

Hi @edoakes 👋 will ray 2.7 release from master branch?

@edoakes
Copy link
Contributor

edoakes commented Aug 25, 2023

@ddelange a release branch will be cut from master today (Friday, Aug 25th). So everything currently in master will be included.

Btw, we've added a basic Python 3.11 release test to avoid breakages now

arvind-chandra pushed a commit to lmco/ray that referenced this pull request Aug 31, 2023
…3.11 (ray-project#37809)

Python 3.11 has a breaking change enforcing the type of `random.sample()` to be a list. Cast the `candidate_replica_ids` to list before feeding into the function.

Signed-off-by: e428265 <[email protected]>
vymao pushed a commit to vymao/ray that referenced this pull request Oct 11, 2023
…3.11 (ray-project#37809)

Python 3.11 has a breaking change enforcing the type of `random.sample()` to be a list. Cast the `candidate_replica_ids` to list before feeding into the function.

Signed-off-by: Victor <[email protected]>
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.

[Serve] python 3.11 random.sample error in HTTPProxyActor
3 participants