Skip to content

[ray-operator] CalculateMinResources should respect workerGroupSpec.Suspend#4958

Merged
andrewsykim merged 1 commit into
ray-project:masterfrom
aditya-786:fix/calculate-min-resources-suspend
Jun 26, 2026
Merged

[ray-operator] CalculateMinResources should respect workerGroupSpec.Suspend#4958
andrewsykim merged 1 commit into
ray-project:masterfrom
aditya-786:fix/calculate-min-resources-suspend

Conversation

@aditya-786

Copy link
Copy Markdown
Contributor

Why are these changes needed?

CalculateMinResources sums the minimum resources of every worker group, including suspended ones, while its sibling functions — CalculateMinReplicas, CalculateMaxReplicas, and CalculateDesiredResources — all skip worker groups with Suspend: true. The Suspend guard was added to those siblings in #2728, but CalculateMinResources was missed.

The Volcano scheduler derives a PodGroup's MinMember from CalculateMinReplicas and its MinResources from CalculateMinResources (batchscheduler/volcano/volcano_scheduler.go). So a suspended worker group with MinReplicas > 0 makes MinResources reserve resources for pods that MinMember does not count — an internally inconsistent gang-scheduling reservation that the MinMember pods can never satisfy.

This adds the same Suspend guard the sibling functions already use, so suspended worker groups are excluded from the minimum-resource total. The existing TestCalculateResources "Head pod with suspended worker group" case uses minReplicas: 0 (so its loop adds nothing and cannot detect the bug); a new case with minReplicas > 0 fails before this change and passes after.

Related issue number

Follow-up to #2728, which added the Suspend guard to the sibling functions.

Checks

  • I've made sure the tests are passing.
  • Testing Strategy
    • Unit tests

…uspend

CalculateMinResources summed the minimum resources of every worker group,
including suspended ones, while its siblings (CalculateMinReplicas,
CalculateMaxReplicas, CalculateDesiredResources) skip suspended groups.
Because the Volcano scheduler derives a PodGroup's MinMember from
CalculateMinReplicas and its MinResources from CalculateMinResources, a
suspended worker group with MinReplicas > 0 made MinResources reserve pods
that MinMember does not account for, an inconsistent gang-scheduling
reservation that the MinMember pods can never satisfy.

Skip suspended worker groups, matching the sibling functions.

Signed-off-by: Aditya Aggarwal <42476079+aditya-786@users.noreply.github.com>
headPodResource := CalculatePodResource(cluster.Spec.HeadGroupSpec.Template.Spec)
minResourcesList = append(minResourcesList, headPodResource)
for _, nodeGroup := range cluster.Spec.WorkerGroupSpecs {
if nodeGroup.Suspend != nil && *nodeGroup.Suspend {

@andrewsykim andrewsykim Jun 26, 2026

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I had added the same change in #4953 and was contemplating if it should be in a separate PR. Thanks for opening

@andrewsykim
andrewsykim merged commit 6d8bad0 into ray-project:master Jun 26, 2026
32 checks passed
troy0820 pushed a commit to troy0820/kuberay that referenced this pull request Jul 13, 2026
…uspend (ray-project#4958)

CalculateMinResources summed the minimum resources of every worker group,
including suspended ones, while its siblings (CalculateMinReplicas,
CalculateMaxReplicas, CalculateDesiredResources) skip suspended groups.
Because the Volcano scheduler derives a PodGroup's MinMember from
CalculateMinReplicas and its MinResources from CalculateMinResources, a
suspended worker group with MinReplicas > 0 made MinResources reserve pods
that MinMember does not account for, an inconsistent gang-scheduling
reservation that the MinMember pods can never satisfy.

Skip suspended worker groups, matching the sibling functions.

Signed-off-by: Aditya Aggarwal <42476079+aditya-786@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants