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

Ray component: Ray Jobs API #36578

Closed
frazierprime opened this issue Jun 20, 2023 · 4 comments · Fixed by #36642
Closed

Ray component: Ray Jobs API #36578

frazierprime opened this issue Jun 20, 2023 · 4 comments · Fixed by #36642
Assignees
Labels
core Issues that should be addressed in Ray Core

Comments

@frazierprime
Copy link
Contributor

frazierprime commented Jun 20, 2023

Description

Hello!
I am a new user, making my way through the jobs API quickstart guide, and I am seeing a strange error. Perhaps I am doing something wrong, in which case please let me know!

Context:

Ray version: ray==2.5.0
I have a local cluster for testing running via this command: ray start --head with a single head node.

ray status output:

ray status
======== Autoscaler status: 2023-06-20 12:11:18.250073 ========
Node status
---------------------------------------------------------------
Healthy:
 1 node_6cab00f1082e513eb8b2fab1bbe4440cd045f2e052e2b253c74e3e31
Pending:
 (no pending nodes)
Recent failures:
 (no failures)

Resources
---------------------------------------------------------------
Usage:
 0.0/8.0 CPU
 0B/17.70GiB memory
 0B/8.85GiB object_store_memory

Demands:
 (no resource demands)

Error:

RuntimeError: Request failed with status code 400: Traceback (most recent call last):
  File "/home/jovyan/.conda/envs/ray-experiments-0/lib/python3.11/site-packages/ray/dashboard/modules/job/job_head.py", line 283, in submit_job
    job_agent_client = await asyncio.wait_for(
                       ^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jovyan/.conda/envs/ray-experiments-0/lib/python3.11/asyncio/tasks.py", line 479, in wait_for
    return fut.result()
           ^^^^^^^^^^^^
  File "/home/jovyan/.conda/envs/ray-experiments-0/lib/python3.11/site-packages/ray/dashboard/modules/job/job_head.py", line 206, in choose_agent
    node_id = sample(set(agent_infos), 1)[0]
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jovyan/.conda/envs/ray-experiments-0/lib/python3.11/random.py", line 439, in sample
    raise TypeError("Population must be a sequence.  "
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

Code:

import ray

@ray.remote
def hello_world():
    return "Hello World!"

ray.init()
print(ray.get(hello_world.remote()))

Command to submit:

ray job submit --working-dir ray_experiments -- python toy_script.py

Link

https://docs.ray.io/en/latest/cluster/running-applications/job-submission/quickstart.html#quickstart-using-the-ray-jobs-cli

@frazierprime frazierprime added docs An issue or change related to documentation triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jun 20, 2023
@frazierprime frazierprime changed the title [<Ray component: Core|RLlib|etc...>] Ray component: Ray Jobs API Jun 20, 2023
@xieus xieus added core Issues that should be addressed in Ray Core and removed docs An issue or change related to documentation triage Needs triage (eg: priority, bug/not-bug, and owning component) labels Jun 20, 2023
@architkulkarni
Copy link
Contributor

This seems to be a breaking change in Python 3.11: https://docs.python.org/3.11/library/random.html#random.sample

@frazierprime Thanks for reporting this, would you be willing to open a PR to fix it? We just need to convert it to a list instead of a set.

@frazierprime
Copy link
Contributor Author

frazierprime commented Jun 21, 2023

This seems to be a breaking change in Python 3.11: https://docs.python.org/3.11/library/random.html#random.sample

@frazierprime Thanks for reporting this, would you be willing to open a PR to fix it? We just need to convert it to a list instead of a set.

#36642

Not letting me add an assignee. Guessing there's some git rule that doesn't allow it. Looks like the dev guide says you all will assign someone shortly. Pinging @rickyyx for visibility.

Also; can't follow your build steps in https://docs.ray.io/en/latest/ray-contribute/getting-involved.html#setting-up-your-development-environment
Basically looks like there is some work to do to bring Ray in line with 3.11 I didn't include it in my PR, since the small change is fairly self contained.

get the following error:

      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-hbtjcxte/numba_588b5e126a824717a38608e494f0015b/setup.py", line 51, in <module>
          _guard_py_ver()
        File "/tmp/pip-install-hbtjcxte/numba_588b5e126a824717a38608e494f0015b/setup.py", line 48, in _guard_py_ver
          raise RuntimeError(msg.format(cur_py, min_py, max_py))
      RuntimeError: Cannot install on Python version 3.11.3; only versions >=3.7,<3.11 are supported.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

architkulkarni pushed a commit that referenced this issue Jun 21, 2023
Breaking change introduced in python 3.11 to the random package https://docs.python.org/3.11/library/random.html#random.sample

Sample throws a type error when passed a non-sequence object (in this case, a set).

This PR changes the set type to sorted, as per the error message:
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

Fixes #36578

Signed-off-by: frazierprime <[email protected]>
@frazierprime
Copy link
Contributor Author

@architkulkarni | @rickyyx - any updates on if/when this fix will go out? I just tested with Ray version 2.5.1 and I am still getting the same error.

@architkulkarni
Copy link
Contributor

architkulkarni commented Jun 23, 2023 via email

arvind-chandra pushed a commit to lmco/ray that referenced this issue Aug 31, 2023
Breaking change introduced in python 3.11 to the random package https://docs.python.org/3.11/library/random.html#random.sample

Sample throws a type error when passed a non-sequence object (in this case, a set).

This PR changes the set type to sorted, as per the error message:
TypeError: Population must be a sequence.  For dicts or sets, use sorted(d).

Fixes ray-project#36578

Signed-off-by: frazierprime <[email protected]>
Signed-off-by: e428265 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Issues that should be addressed in Ray Core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants