Skip to content

fix: unify gang unschedulable counts across PodGroup condition, event, and Pod - #6202

Open
vishalmore90 wants to merge 1 commit into
volcano-sh:masterfrom
vishalmore90:fix-issue-6200
Open

vishalmore90 wants to merge 1 commit into
volcano-sh:masterfrom
vishalmore90:fix-issue-6200

Conversation

@vishalmore90

Copy link
Copy Markdown

What type of PR is this?

/kind bug

What this PR does / why we need it:

Fixes an inconsistency between PodGroup conditions, PodGroup warning events, and Pod status conditions when a gang scheduling restriction cannot be satisfied.

Prior to this PR:

  1. gang.OnSessionClose calculated the unmet task count using minAvailable - schedulableTaskNum() when recording the PodGroup Unschedulable condition.
  2. SchedulerCache.RecordJobStatusEvent recalculated the PodGroup warning event message using len(job.TaskStatusIndex[Pending]), leading to different task counts being reported for the event vs the condition.
  3. Pending pods without explicit predicate errors fell back to job.FitError(), omitting the N/M tasks in gang unschedulable: prefix specified in docs/design/scheduling-reason.md.

This PR:

  • Adds GetPodGroupCondition and SchedulableTaskNum to JobInfo to share the calculation logic.
  • Updates SchedulerCache.RecordJobStatusEvent to reuse the PodGroup unschedulable condition message for both the PodGroup warning event and pending pod fallback condition.
  • Falls back to job.MinAvailable - job.SchedulableTaskNum() when computing gang unready task count if the condition message is not pre-populated.
  • Adds comprehensive table-driven unit tests in pkg/scheduler/api and pkg/scheduler/cache.

Which issue(s) this PR fixes:

Fixes #6200

Special notes for your reviewer:

AI disclosure: Prepared with assistance from AI coding tools adhering to Volcano's AI guidance in CONTRIBUTING.md. All code, tests, and verifications were reviewed and verified against repo guidelines.

Does this PR introduce a user-facing change?

Fix inconsistent unschedulable task counts across PodGroup condition, PodGroup warning event, and Pod conditions for gang jobs.

@volcano-sh-bot volcano-sh-bot added the kind/bug Categorizes issue or PR as related to a bug. label Oct 29, 2026
@volcano-sh-bot

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign jessestutler for approval. For more information see the Kubernetes Code Review Process.

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

Details 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

@volcano-sh-bot volcano-sh-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Oct 29, 2026
@vishalmore90

Copy link
Copy Markdown
Author

/review

@JesseStutler

Copy link
Copy Markdown
Member

Thanks. I will review it recently, but your ut failed, please check the CI's log @vishalmore90

Signed-off-by: vishal <httpsvishal07@gmail.com>
@vishalmore90

Copy link
Copy Markdown
Author

@JesseStutler Please Take A Look whenever u get chance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Gang unschedulable counts differ across Pod, PodGroup condition, and Event

3 participants