-
Notifications
You must be signed in to change notification settings - Fork 41
The workerReplicas parameter has been made an optional field.
#655
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
base: main
Are you sure you want to change the base?
Conversation
Summary of ChangesHello @LiZhenCheng9527, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request enhances the flexibility of the Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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 makes the workerReplicas field optional in the Role struct, changing it to a pointer and setting a default value of 0. The changes are propagated throughout the codebase, including controllers, utility functions, and tests, to handle the new pointer type correctly by checking for nil values. My review found a few areas for improvement:
- The documentation and code comments for
workerReplicasstill incorrectly state that the field is required. - There is a typo in a variable name (
workerReplicase) in thepodgroupmanager.
I've added specific comments with suggestions to address these points. Overall, the change is well-implemented.
| | `replicas` _integer_ | The number of a certain role.<br />For example, in Disaggregated Prefilling, setting the replica count for both the P and D roles to 1 results in 1P1D deployment configuration.<br />This approach can similarly be applied to configure a xPyD deployment scenario.<br />Default to 1. | 1 | | | ||
| | `entryTemplate` _[PodTemplateSpec](#podtemplatespec)_ | EntryTemplate defines the template for the entry pod of a role.<br />Required: Currently, a role must have only one entry-pod. | | | | ||
| | `workerReplicas` _integer_ | WorkerReplicas defines the number for the worker pod of a role.<br />Required: Need to set the number of worker-pod replicas. | | | | ||
| | `workerReplicas` _integer_ | WorkerReplicas defines the number for the worker pod of a role.<br />Required: Need to set the number of worker-pod replicas. | 0 | | |
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.
The description for workerReplicas still states that it is required. Since this field is now optional with a default value of 0, the documentation should be updated to reflect this change.
| | `workerReplicas` _integer_ | WorkerReplicas defines the number for the worker pod of a role.<br />Required: Need to set the number of worker-pod replicas. | 0 | | | |
| | `workerReplicas` _integer_ | WorkerReplicas defines the number for the worker pod of a role.<br />Optional: Defaults to 0 if not specified. | 0 | | |
| EntryTemplate PodTemplateSpec `json:"entryTemplate"` | ||
|
|
||
| // WorkerReplicas defines the number for the worker pod of a role. | ||
| // Required: Need to set the number of worker-pod replicas. |
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.
| workerReplicase := 0 | ||
| if role.WorkerReplicas != nil { | ||
| workerReplicase = int(*role.WorkerReplicas) | ||
| } | ||
| podsPerTask := 1 + workerReplicase // entry + workers |
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.
There's a typo in the variable name workerReplicase. It should be workerReplicas.
| workerReplicase := 0 | |
| if role.WorkerReplicas != nil { | |
| workerReplicase = int(*role.WorkerReplicas) | |
| } | |
| podsPerTask := 1 + workerReplicase // entry + workers | |
| workerReplicas := 0 | |
| if role.WorkerReplicas != nil { | |
| workerReplicas = int(*role.WorkerReplicas) | |
| } | |
| podsPerTask := 1 + workerReplicas // entry + workers |
| minResources = m.aggregateResources(minResources, &role.EntryTemplate.Spec, expectReplicas) | ||
| if role.WorkerTemplate != nil { | ||
| for i := 0; i < int(role.WorkerReplicas); i++ { | ||
| for i := 0; i < workerReplicase; i++ { |
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.
83d6db2 to
c1a2bfb
Compare
hzxuzhonghu
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.
Not sure whta's the motivation. And in k8s the pointer type is to distinguish 0 and nil, it seems 0 and nil is same here
Signed-off-by: LiZhenCheng9527 <lizhencheng6@huawei.com>
d46ebe4 to
472100b
Compare
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
What type of PR is this?
/kind enhancement
What this PR does / why we need it:
To:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer:
Does this PR introduce a user-facing change?: