-
Notifications
You must be signed in to change notification settings - Fork 402
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RayCluster created by RayService set death info env for ray container #419
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -225,7 +225,7 @@ func initReadinessProbeHandler(probe *v1.Probe, rayNodeType rayiov1alpha1.RayNod | |
} | ||
|
||
// BuildPod a pod config | ||
func BuildPod(podTemplateSpec v1.PodTemplateSpec, rayNodeType rayiov1alpha1.RayNodeType, rayStartParams map[string]string, svcName string, headPort string, enableRayAutoscaler *bool) (aPod v1.Pod) { | ||
func BuildPod(podTemplateSpec v1.PodTemplateSpec, rayNodeType rayiov1alpha1.RayNodeType, rayStartParams map[string]string, svcName string, headPort string, enableRayAutoscaler *bool, createdByRayService bool) (aPod v1.Pod) { | ||
pod := v1.Pod{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: "v1", | ||
|
@@ -283,7 +283,7 @@ func BuildPod(podTemplateSpec v1.PodTemplateSpec, rayNodeType rayiov1alpha1.RayN | |
setInitContainerEnvVars(&pod.Spec.InitContainers[index], svcName) | ||
} | ||
|
||
setContainerEnvVars(&pod, rayContainerIndex, rayNodeType, rayStartParams, svcName, headPort) | ||
setContainerEnvVars(&pod, rayContainerIndex, rayNodeType, rayStartParams, svcName, headPort, createdByRayService) | ||
|
||
// health check only if HA enabled | ||
if podTemplateSpec.Annotations != nil { | ||
|
@@ -487,7 +487,7 @@ func setInitContainerEnvVars(container *v1.Container, svcName string) { | |
} | ||
} | ||
|
||
func setContainerEnvVars(pod *v1.Pod, rayContainerIndex int, rayNodeType rayiov1alpha1.RayNodeType, rayStartParams map[string]string, svcName string, headPort string) { | ||
func setContainerEnvVars(pod *v1.Pod, rayContainerIndex int, rayNodeType rayiov1alpha1.RayNodeType, rayStartParams map[string]string, svcName string, headPort string, createdByRayService bool) { | ||
// set IP to local host if head, or the the svc otherwise RAY_IP | ||
// set the port RAY_PORT | ||
// set the password? | ||
|
@@ -513,6 +513,13 @@ func setContainerEnvVars(pod *v1.Pod, rayContainerIndex int, rayNodeType rayiov1 | |
portEnv := v1.EnvVar{Name: RAY_PORT, Value: headPort} | ||
container.Env = append(container.Env, portEnv) | ||
} | ||
if createdByRayService { | ||
// Only add this env for Ray Service cluster to improve service SLA. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we only need this in Ray Service? what about other scenarios? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @iycheng mentioned this will increase SLA for ray service. |
||
if !envVarExists(RAY_TIMEOUT_MS_TASK_WAIT_FOR_DEATH_INFO, container.Env) { | ||
deathEnv := v1.EnvVar{Name: RAY_TIMEOUT_MS_TASK_WAIT_FOR_DEATH_INFO, Value: "0"} | ||
container.Env = append(container.Env, deathEnv) | ||
} | ||
} | ||
// Setting the RAY_ADDRESS env allows connecting to Ray using ray.init() when connecting | ||
// from within the cluster. | ||
if !envVarExists(RAY_ADDRESS, container.Env) { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think thinking if there's better way to indicate a cluster is created by RayServe controller.
Can we leverage
kuberay/ray-operator/controllers/ray/common/constant.go
Line 29 in 50d4782
This help us not expand method arguments if we need some customization on clusters created by RayJob etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sg