-
Notifications
You must be signed in to change notification settings - Fork 454
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
[kubectl-plugin] Support specifying number of head GPUs and worker GPUs for Rayjob #2989
Open
win5923
wants to merge
1
commit into
ray-project:master
Choose a base branch
from
win5923:kubectl-job-gpu
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+28
−27
Conversation
This file contains 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
99f47be
to
c063a9a
Compare
win5923
commented
Feb 9, 2025
Comment on lines
-104
to
-131
// If the HeadGPU resource is set with a value, then proceed with parsing. | ||
if rayClusterSpecObject.HeadGPU != "" { | ||
headGPUResource := resource.MustParse(rayClusterSpecObject.HeadGPU) | ||
if !headGPUResource.IsZero() { | ||
var requests, limits corev1.ResourceList | ||
requests = *rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Requests | ||
limits = *rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Limits | ||
requests[corev1.ResourceName(resourceNvidiaGPU)] = headGPUResource | ||
limits[corev1.ResourceName(resourceNvidiaGPU)] = headGPUResource | ||
|
||
rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Requests = &requests | ||
rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Limits = &limits | ||
} | ||
headGPUResource := resource.MustParse(rayClusterSpecObject.HeadGPU) | ||
if !headGPUResource.IsZero() { | ||
var requests, limits corev1.ResourceList | ||
requests = *rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Requests | ||
limits = *rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Limits | ||
requests[corev1.ResourceName(resourceNvidiaGPU)] = headGPUResource | ||
limits[corev1.ResourceName(resourceNvidiaGPU)] = headGPUResource | ||
|
||
rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Requests = &requests | ||
rayClusterSpec.HeadGroupSpec.Template.Spec.Containers[0].Resources.Limits = &limits | ||
} | ||
|
||
// If the workerGPU resource is set with a value, then proceed with parsing. | ||
if rayClusterSpecObject.WorkerGPU != "" { | ||
workerGPUResource := resource.MustParse(rayClusterSpecObject.WorkerGPU) | ||
if !workerGPUResource.IsZero() { | ||
var requests, limits corev1.ResourceList | ||
requests = *rayClusterSpec.WorkerGroupSpecs[0].Template.Spec.Containers[0].Resources.Requests | ||
limits = *rayClusterSpec.WorkerGroupSpecs[0].Template.Spec.Containers[0].Resources.Limits | ||
requests[corev1.ResourceName(resourceNvidiaGPU)] = workerGPUResource | ||
limits[corev1.ResourceName(resourceNvidiaGPU)] = workerGPUResource | ||
|
||
rayClusterSpec.WorkerGroupSpecs[0].Template.Spec.Containers[0].Resources.Requests = &requests | ||
rayClusterSpec.WorkerGroupSpecs[0].Template.Spec.Containers[0].Resources.Limits = &limits | ||
} |
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.
Previously, kubectl ray job submit
did not support setting headGPU
and workerGPU
, which caused a panic. With this addition, the original implementation can now be restored.
c063a9a
to
811c3e5
Compare
…Us for Rayjob Signed-off-by: win5923 <[email protected]>
811c3e5
to
8b82054
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Why are these changes needed?
As title
Manual Test
For worker pod:
![image](https://private-user-images.githubusercontent.com/56353753/411296731-fd0bbc3c-b361-4f9a-9801-26333cb05a0f.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzg5NzAsIm5iZiI6MTczOTE3ODY3MCwicGF0aCI6Ii81NjM1Mzc1My80MTEyOTY3MzEtZmQwYmJjM2MtYjM2MS00ZjlhLTk4MDEtMjYzMzNjYjA1YTBmLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA5MTExMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWIzZDZjMWQyMTExYWQ4MThmOGYyODdlYWEzYzc1OGI3NjJkZDFjMTMzOTllZWE1NWI1YTFlMTllMWJmZTkwMGUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.1gaO_9Pi8CW8OAX6NDqny50-t6ICNQUiwY_YIJXgHvk)
For head pod:
![image](https://private-user-images.githubusercontent.com/56353753/411296752-955e3472-cbe5-4d4e-a1b3-49633386296d.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkxNzg5NzAsIm5iZiI6MTczOTE3ODY3MCwicGF0aCI6Ii81NjM1Mzc1My80MTEyOTY3NTItOTU1ZTM0NzItY2JlNS00ZDRlLWExYjMtNDk2MzMzODYyOTZkLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMTAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjEwVDA5MTExMFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTliODczODRjODFkNmEyODdkYzJiMGVhMDllMjJhODJhOTFlYTNjYjIwODM5ODdhNzY5NWM0ZjFkZTdjOGI5YjEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.WEhw9d61dBN0hzVeHREZ4eRK9eDCVNtZ9BCwcFV6cgE)
Related issue number
Checks