-
Notifications
You must be signed in to change notification settings - Fork 7k
[Autoscaler][V2] Add top-level Resources and Labels field to KubeRay Autoscaling config #57260
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
[Autoscaler][V2] Add top-level Resources and Labels field to KubeRay Autoscaling config #57260
Conversation
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
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.
Code Review
This pull request adds support for top-level Resources and Labels fields in the KubeRay autoscaling configuration, which is a great enhancement for usability and alignment with upcoming KubeRay features. The implementation correctly prioritizes these new fields over older configuration methods. The accompanying tests are thorough and cover the new functionality well. I've identified a few areas for improvement, mainly concerning type consistency in function signatures and return values, which could prevent potential bugs and improve code clarity. There is also a minor documentation error in a docstring. Overall, this is a solid contribution.
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
Signed-off-by: Ryan O'Leary <[email protected]>
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.
Just one curious question. Overall looks good!
Also you might need to fix the doc lint issue:
[2025-10-11T01:27:22Z] ./python/ray/autoscaler/_private/kuberay/autoscaling_config.py: f"Ignoring labels: {labels_str} set in rayStartParams. Group labels are supported in the top-level Labels field starting in Kuberay v1.5"
[2025-10-11T01:27:22Z] ./python/ray/tests/kuberay/test_autoscaling_config.py: "Ignoring labels: ray.io/accelerator-type=TPU-V4 set in rayStartParams. Group labels are supported in the top-level Labels field starting in Kuberay v1.5",
[2025-10-11T01:27:22Z] ./python/ray/tests/kuberay/test_autoscaling_config.py: "Ignoring labels: instance-type=n2 set in rayStartParams. Group labels are supported in the top-level Labels field starting in Kuberay v1.5",
[2025-10-11T01:27:22Z] ******************************
[2025-10-11T01:27:22Z] *** Misspelled word found! ***
[2025-10-11T01:27:22Z] ******************************
[2025-10-11T01:27:22Z] Please fix the capitalization/spelling of "Kuberay" in the above files.```
Signed-off-by: Ryan O'Leary <[email protected]>
Oh I think I've seen this before, it's because I failed to capitalize the "R" in "KubeRay". Should be fixed with d0ea801. |
MengjinYan
left a comment
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.
Thanks!
|
@rueian if you want to take a look from autoscaler's perspective. |
edoakes
left a comment
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.
🚀
…Autoscaling config (ray-project#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to ray-project#51564 --------- Signed-off-by: Ryan O'Leary <[email protected]>
…Autoscaling config (ray-project#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to ray-project#51564 --------- Signed-off-by: Ryan O'Leary <[email protected]> Signed-off-by: xgui <[email protected]>
…Autoscaling config (#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to #51564 --------- Signed-off-by: Ryan O'Leary <[email protected]> Signed-off-by: elliot-barn <[email protected]>
…Autoscaling config (ray-project#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to ray-project#51564 --------- Signed-off-by: Ryan O'Leary <[email protected]>
…Autoscaling config (ray-project#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to ray-project#51564 --------- Signed-off-by: Ryan O'Leary <[email protected]> Signed-off-by: Aydin Abiar <[email protected]>
…Autoscaling config (ray-project#57260) In KubeRay v1.5, new structured `Resources` and `Labels` fields will be added to both the `HeadGroupSpec` and `WorkerGroupSpec` to enable users to explicitly define these values without relying on `rayStartParams`. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking the `resources` and `labels` field (with precedence over the values `rayStartParams` and k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified. Example: For a group spec specified like this: ``` workerGroupSpecs: - groupName: worker-group-1 replicas: 1 resources: GPU: 8 CPU: 16 labels: ray.io/zone: us-west2-a ray.io/region: us-west2 ``` The resulting autoscaling config for worker-group-1 would be: ``` "worker-group-1": { "labels": {" ray.io/zone": "us-west2-a", " ray.io/region": "us-west2"}, ... "resources": { "CPU": 16, GPU: 8, }, }, ``` ## Related issue number Contributes to ray-project#51564 --------- Signed-off-by: Ryan O'Leary <[email protected]> Signed-off-by: Future-Outlier <[email protected]>
Why are these changes needed?
In KubeRay v1.5, new structured
ResourcesandLabelsfields will be added to both theHeadGroupSpecandWorkerGroupSpecto enable users to explicitly define these values without relying onrayStartParams. This support is implemented in ray-project/kuberay#4106. In order for this change to work with the Ray autoscaler, this PR adds support for checking theresourcesandlabelsfield (with precedence over the valuesrayStartParamsand k8s constainer spec) and generating the resulting autoscaling config. This change is compatible with older versions of KubeRay that do not have these new fields, since we fall back to the previous logic when the top-level fields aren't specified.Example:
For a group spec specified like this:
The resulting autoscaling config for worker-group-1 would be:
Related issue number
Contributes to #51564
Checks
git commit -s) in this PR.method in Tune, I've added it in
doc/source/tune/api/under thecorresponding
.rstfile.