SubGroupPolicy enables optimized Kthena subgroup-based Gang Scheduling - #4785
Conversation
Summary of ChangesHello @wangyang0616, 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 significantly advances Volcano's Gang Scheduling capabilities by introducing a more sophisticated Highlights
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.
Code Review
This pull request significantly improves the SubGroupPolicy API by aligning it with standard Kubernetes practices using LabelSelector, which is a great enhancement. The refactoring of the test suite is also a major improvement in code quality and maintainability.
I've identified a few issues that need attention:
- A critical issue with the
go.modfile pointing to a personal fork, which must be addressed before merging. - A potential bug in
getSubJobMatchValueswhere it returns an empty slice instead ofnilfor non-matching pods, which could break existing logic. - An inconsistency in the
Clonemethod injob_info.gowherePartitionsare not correctly deep-copied. - A minor issue with a misleading comment in a test case.
Overall, this is a valuable contribution. Addressing these points will make it even better.
| name: "partition size 0 (invalid), index 5", | ||
| partitionSize: 0, | ||
| index: 5, | ||
| expectedPart: "-1", // Go returns 0 for division by zero |
There was a problem hiding this comment.
The comment // Go returns 0 for division by zero is incorrect. In Go, integer division by zero causes a runtime panic. The code in createJobPod correctly handles this edge case by checking if ts.PartitionPolicy.PartitionSize <= 0 and setting partitionID to -1, which is what this test case correctly asserts. The comment is misleading and should be removed or corrected to reflect the actual behavior.
| expectedPart: "-1", // Go returns 0 for division by zero | |
| expectedPart: "-1", |
30a1c2f to
87d0fd9
Compare
| MatchLabelKeys: []string{"any"}, | ||
| }, | ||
| pod: &v1.Pod{ | ||
| ObjectMeta: metav1.ObjectMeta{}, // 无标签 |
There was a problem hiding this comment.
Please delete the Chinese comment
| { | ||
| LabelKey: "key2", | ||
| Key: "app", | ||
| Operator: "invalid", // 无效的操作符 |
There was a problem hiding this comment.
Same as above. Please check all the Chinese comments if we don't need it
|
Just want to verify that does this PR means that the pods must first match the labelSelector, and then be divided into different groups based on different keys? @wangyang0616 |
hzxuzhonghu
left a comment
There was a problem hiding this comment.
LGTM, not big problem, since this is mostly the logic updating subJob construction, while the scheduling has already been merged
| job.Pods[key] = make(map[string]*v1.Pod, len(pods)) | ||
| for pn, pod := range pods { | ||
| job.Pods[key][pn] = pod | ||
| clonedPod := pod.DeepCopy() |
There was a problem hiding this comment.
I donot see we mutate the pod. Deepcopy is a costy op, so i think maybe we can keep it as still
There was a problem hiding this comment.
You're right. The change has been reverted.
Yes, LabelSelector is an explicit condition that defines the valid scope for pod grouping. When the controller creates a PodGroup based on a VCJob, it automatically configures the LabelSelector information to match the corresponding tasks. |
| return values | ||
|
|
||
| // Log when no matching rules are configured, using default group | ||
| klog.V(4).Infof("No MatchLabelKeys configured for policy, pod %s/%s uses default subjob group", pod.Namespace, pod.Name) |
There was a problem hiding this comment.
If a pod matches the LabelSelector but is missing some labels in MatchLabelKeys, then it will belongs to the default subjob, right?
There was a problem hiding this comment.
I think it is better that if a SubGroupPolicy is configured with only LabelSelector and empty MatchLabelKeys, the pods matching the LabelSelector should be assigned to a separate SubJob.
There was a problem hiding this comment.
For the definition of subgroup, it is recommended to use LabelSelector and matchLabelKey in combination, and express the subgroup logic through explicit declaration. This avoids excessive implicit default behaviors and improves maintainability.
|
/retest |
Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
… the YAML files Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
d4e39ca to
44f392e
Compare
Signed-off-by: wangyang0616 <wangyang8126@gmail.com>
44f392e to
08a9b37
Compare
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hzxuzhonghu The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Fixes #4781
Related Apis #202