Skip to content

Conversation

@wuyueandrew
Copy link
Contributor

What type of PR is this?

What this PR does / why we need it:

Which issue(s) this PR fixes:

Fixes #4528

Special notes for your reviewer:

Does this PR introduce a user-facing change?


Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @wuyueandrew, 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 nodegroup scheduler plugin by introducing a configurable "nonstrict" mode. This mode modifies the behavior of queue-group affinity checks and scoring, making the scheduler more resilient to scenarios where queues might not have strictly defined node group affiliations, particularly for queues that might temporarily or permanently have zero associated nodes.

Highlights

  • New Configuration Option: Introduced a "nonstrict" boolean configuration option for the nodegroup plugin, allowing for more flexible handling of node group affinities.
  • Predicate Logic Adjustment: Modified the predicate function within queueGroupAffinity to bypass strict group requirements when nonstrict mode is enabled, preventing tasks from being unschedulable if a queue has no associated groups.
  • Scoring Behavior Modification: Adjusted the score function to assign a specific negative score (-2) when nonstrict mode is active and a queue has no associated nodes, influencing scheduling decisions.
Using Gemini Code Assist

The 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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@volcano-sh-bot volcano-sh-bot added the size/S Denotes a PR that changes 10-29 lines, ignoring generated files. label Sep 7, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a 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 introduces a nonstrict mode to the nodegroup plugin, allowing queues to schedule on nodes without explicit affinity, which is useful for queues that might not have dedicated nodes. The implementation is straightforward, but I've identified a significant pre-existing bug in the predicate logic that is exacerbated by this change. Additionally, I've provided some suggestions to improve code clarity. A crucial omission is the lack of unit tests for the new nonstrict functionality; adding tests would be essential to ensure correctness and prevent future regressions.

Comment on lines 74 to 124
flag := false
if nonstrict {
flag = true
}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

This initialization can be simplified for better readability.

Suggested change
flag := false
if nonstrict {
flag = true
}
flag := nonstrict

return nodeScore
}
if nonstrict {
nodeScore = -2

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The value -2 is a magic number. It would be better to define it as a constant at the top of the file (e.g., const NonStrictPenalty = -2) to improve readability and maintainability.

if len(queue) == 0 {
return nodeScore
}
if nonstrict {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ut needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ut done

@volcano-sh-bot volcano-sh-bot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Sep 18, 2025
@kingeasternsun
Copy link
Contributor

/lgtm

@volcano-sh-bot volcano-sh-bot added the lgtm Indicates that a PR is ready to be merged. label Sep 19, 2025
type nodeGroupPlugin struct {
// Arguments given for the plugin
pluginArguments framework.Arguments
nonstrict bool
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to set a strict flag instead of nonstricet, which is more understandable, and it's defaut value is true.

@Monokaix
Copy link
Member

And please also update the ndoegroup design doc to include this parameter and merge to one commit is OK.

@volcano-sh-bot volcano-sh-bot removed the lgtm Indicates that a PR is ready to be merged. label Sep 22, 2025
@volcano-sh-bot
Copy link
Contributor

New changes are detected. LGTM label has been removed.

@wuyueandrew
Copy link
Contributor Author

And please also update the ndoegroup design doc to include this parameter and merge to one commit is OK.

done

@volcano-sh-bot volcano-sh-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2025
@volcano-sh-bot volcano-sh-bot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 24, 2025
@wuyueandrew wuyueandrew force-pushed the issue4528 branch 3 times, most recently from 2356df9 to d33ea69 Compare September 26, 2025 08:57
@Monokaix
Copy link
Member

/approve

@volcano-sh-bot volcano-sh-bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Sep 26, 2025
// New function returns prioritize plugin object.
func New(arguments framework.Arguments) framework.Plugin {
return &nodeGroupPlugin{pluginArguments: arguments}
nodeGroupPlugin := &nodeGroupPlugin{pluginArguments: arguments, strict: true}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should also update nodegroup plugin user guide? But we will release v1.13.0 soon, if you have limit time to update it, you can also seperate in the other PR @wuyueandrew

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: Monokaix

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

- name: predicates
- name: proportion
- name: nodegroup
strict: false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's

- name: nodegroup
   arguments:
     strict: false


### Nodegroup Plugin Strict Configuration

Strict is a switch to specific behavior of unset affinity queue. If `strict: false`, workload assigned to a unset affinity queue could be scheduled to Node with empty label `volcano.sh/nodegroup-name`. Otherwise, workload cannot be scheduled.
Copy link
Member

@JesseStutler JesseStutler Sep 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that it's if the node doesn't have the "volcano.sh/nodegroup-name" label or the queue doesn't set affinity ?

Comment on lines +287 to +291
if np.strict || !unsetAffinity {
return newFitErr(task, node, errNodeGroupLabelNotFound)
} else {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if np.strict || !unsetAffinity {
return newFitErr(task, node, errNodeGroupLabelNotFound)
} else {
return nil
}
if np.strict || !unsetAffinity {
return newFitErr(task, node, errNodeGroupLabelNotFound)
}
return nil

Comment on lines +280 to +282
} else {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
return nil
}
}
return nil

Comment on lines +297 to +299
} else {
return nil
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
} else {
return nil
}
return nil

@JesseStutler
Copy link
Member

@kingeasternsun @Monokaix Consider we need to release new version asap and @wuyueandrew has no time currently, I have made a new PR and we can merge that #4652

@volcano-sh-bot volcano-sh-bot merged commit dfd2b80 into volcano-sh:master Sep 28, 2025
17 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NodeGroup: when a queue does not specify affinity, load is allowed to be scheduled to any node

5 participants