Skip to content
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,23 @@ func (v *VolcanoBatchScheduler) handleRayJob(ctx context.Context, rayJob *rayv1.
// MinMember intentionally excludes the submitter pod to avoid a startup deadlock
// (submitter waits for cluster; gang would wait for submitter). We still add the
// submitter's resource requests into MinResources so capacity is reserved.
if rayJob.Spec.SubmissionMode == rayv1.K8sJobMode || rayJob.Spec.SubmissionMode == rayv1.SidecarMode {
submitterResource := getSubmitterResource(rayJob)
totalResourceList = append(totalResourceList, submitterResource)
return v.syncPodGroup(ctx, rayJob, minMember, utils.SumResourceList(totalResourceList))
}

func getSubmitterResource(rayJob *rayv1.RayJob) corev1.ResourceList {
if rayJob.Spec.SubmissionMode == rayv1.K8sJobMode {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do we need to do this for SidecarMode?

Copy link
Member

@Future-Outlier Future-Outlier Oct 8, 2025

Choose a reason for hiding this comment

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

I think in SidecarMode, when calculating the head pod's resource, we will call the function CalculatePodResource, and this func will iterate all containers in the head pod spec like thisfor _, container := range podSpec.Containers.
so I think sidecar mode will work, but if we can get a screenshot about a test for sidecar mode I will appreciate it.

cc @win5923

Copy link
Member

Choose a reason for hiding this comment

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

wait, @rueian is right.
when using sidecar mode, the Min Resources's CPU shoulde be 3.5, but this is not correct here.

Image

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Thanks @rueian!
I’ve already added the check for SidecarMode. ae2941f

image

submitterTemplate := common.GetSubmitterTemplate(&rayJob.Spec, rayJob.Spec.RayClusterSpec)
submitterResource := utils.CalculatePodResource(submitterTemplate.Spec)
totalResourceList = append(totalResourceList, submitterResource)
return utils.CalculatePodResource(submitterTemplate.Spec)
} else if rayJob.Spec.SubmissionMode == rayv1.SidecarMode {
submitterContainer := common.GetDefaultSubmitterContainer(rayJob.Spec.RayClusterSpec)
return corev1.ResourceList{
corev1.ResourceCPU: submitterContainer.Resources.Requests[corev1.ResourceCPU],
corev1.ResourceMemory: submitterContainer.Resources.Requests[corev1.ResourceMemory],
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can we take all the resource types into account here? We'd better not assume there are only CPU and memory.

Copy link
Member

Choose a reason for hiding this comment

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

just fix it here, thank you!
cf6b48b

}
}

return v.syncPodGroup(ctx, rayJob, minMember, utils.SumResourceList(totalResourceList))
return corev1.ResourceList{}
}

func getAppPodGroupName(object metav1.Object) string {
Expand Down
Loading