From 7adf247b27d6f86268103a17b5fd7363c4709c36 Mon Sep 17 00:00:00 2001 From: Archit Kulkarni Date: Thu, 5 Oct 2023 12:47:45 -0700 Subject: [PATCH] [RayJob] Add default CPU and memory for job submitter pod (#1319) Adds a default CPU and memory resource requirement for the pod that submits the RayJob. image Here's the memory and CPU usage of the job submitter pod with a job entrypoint script that prints "hello world" in a tight loop from Python. I tested it on a local kind cluster. Since the job submitter pod just calls ray job submit which runs the job remotely and streams the job output to stdout on the submitter pod, this kind of log streaming job should be the most stressful from the perspective of the job submitter pod. Based on this, we set the requests to 500m CPU and 200MiB memory, and set the limits to 1 CPU and 1GiB memory. Why are these changes needed? It's good to provide reasonable defaults to reduce the burden on the user. Related issue number Closes #1198 --------- Signed-off-by: Archit Kulkarni --- ray-operator/controllers/ray/common/job.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ray-operator/controllers/ray/common/job.go b/ray-operator/controllers/ray/common/job.go index b0e5b771884..dcdbdf0c336 100644 --- a/ray-operator/controllers/ray/common/job.go +++ b/ray-operator/controllers/ray/common/job.go @@ -10,6 +10,7 @@ import ( "github.com/google/shlex" rayv1alpha1 "github.com/ray-project/kuberay/ray-operator/apis/ray/v1alpha1" v1 "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/api/resource" "sigs.k8s.io/yaml" ) @@ -154,6 +155,16 @@ func GetDefaultSubmitterTemplate(rayJobInstance *rayv1alpha1.RayJob) v1.PodTempl { Name: "ray-job-submitter", Image: image, + Resources: v1.ResourceRequirements{ + Limits: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("1"), + v1.ResourceMemory: resource.MustParse("1Gi"), + }, + Requests: v1.ResourceList{ + v1.ResourceCPU: resource.MustParse("500m"), + v1.ResourceMemory: resource.MustParse("200Mi"), + }, + }, }, }, RestartPolicy: v1.RestartPolicyNever,