-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[core] runtime context resource ids getter #26907
Conversation
Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
Note that we should absolutely get this in for 2.0 (to clean up the XGBoost experience). |
python/ray/runtime_context.py
Outdated
"""Get the assigned resources to this worker. | ||
|
||
Returns: | ||
A dictionary mapping the name of a resource to a list of pairs, where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should return a dict mapping from resource name to count. Id of the resource is only meaningful for GPU and we already have a ray.worker.get_gpu_ids()
for that purpose. Also feel we should copy get_gpu_ids()
into runtime context as well for consistency.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I updated and added a docstring. Can you take a look?
I also won't address the get_gpu_ids() thing since we should probably have a broader discussion there (get_gpu_ids() is frequently used in multiple libraries?)
Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Richard Liaw <[email protected]>
Following ray-project/ray#26907, we can now avoid a deprecation message when using XGBRay with 2.0. Signed-off-by: Richard Liaw <[email protected]>
Signed-off-by: Rohan138 <[email protected]>
Signed-off-by: Stefan van der Kleij <[email protected]>
Why are these changes needed?
We’re seeing a deprecation message from XGBoost Ray:
DeprecationWarning:
ray.worker.get_resource_ids
is a private attribute and access will be removed in a future Ray version.and we use this function call in two places for XGboost:
To set the right OMP_NUM_THREADS per actor (=num cpus assigned to the actor).
Configuring the right number of threads for the XGBoost model (=num cpus per worker).
The current workaround will be to thread the num_cpus_per_worker configuration from the driver through all the actors, but ideally (1) would be configured for us.
Related issue number
Checks
scripts/format.sh
to lint the changes in this PR.