4444
4545logger = logging .getLogger (__name__ )
4646
47+ MOUNT_PATH = "/home/ray/scripts"
48+
4749dir = pathlib .Path (__file__ ).parent .parent .resolve ()
4850
4951# https://docs.ray.io/en/latest/ray-core/scheduling/accelerators.html
@@ -139,20 +141,12 @@ class ManagedClusterConfig:
139141 A list of V1Volume objects to add to the Cluster
140142 volume_mounts:
141143 A list of V1VolumeMount objects to add to the Cluster
142- enable_gcs_ft:
143- A boolean indicating whether to enable GCS fault tolerance.
144- redis_address:
145- The address of the Redis server to use for GCS fault tolerance, required when enable_gcs_ft is True.
146- redis_password_secret:
147- Kubernetes secret reference containing Redis password. ex: {"name": "secret-name", "key": "password-key"}
148- external_storage_namespace:
149- The storage namespace to use for GCS fault tolerance. By default, KubeRay sets it to the UID of RayCluster.
150144 """
151145
152146 head_cpu_requests : Union [int , str ] = 2
153147 head_cpu_limits : Union [int , str ] = 2
154- head_memory_requests : Union [int , str ] = 8
155- head_memory_limits : Union [int , str ] = 8
148+ head_memory_requests : Union [int , str ] = 2
149+ head_memory_limits : Union [int , str ] = 2
156150 head_accelerators : Dict [str , Union [str , int ]] = field (default_factory = dict )
157151 head_tolerations : Optional [List [V1Toleration ]] = None
158152 worker_cpu_requests : Union [int , str ] = 1
@@ -173,35 +167,10 @@ class ManagedClusterConfig:
173167 annotations : Dict [str , str ] = field (default_factory = dict )
174168 volumes : list [V1Volume ] = field (default_factory = list )
175169 volume_mounts : list [V1VolumeMount ] = field (default_factory = list )
176- enable_gcs_ft : bool = False
177- redis_address : Optional [str ] = None
178- redis_password_secret : Optional [Dict [str , str ]] = None
179- external_storage_namespace : Optional [str ] = None
180170
181171 def __post_init__ (self ):
182172 self .envs ["RAY_USAGE_STATS_ENABLED" ] = "0"
183173
184- if self .enable_gcs_ft :
185- if not self .redis_address :
186- raise ValueError (
187- "redis_address must be provided when enable_gcs_ft is True"
188- )
189-
190- if self .redis_password_secret and not isinstance (
191- self .redis_password_secret , dict
192- ):
193- raise ValueError (
194- "redis_password_secret must be a dictionary with 'name' and 'key' fields"
195- )
196-
197- if self .redis_password_secret and (
198- "name" not in self .redis_password_secret
199- or "key" not in self .redis_password_secret
200- ):
201- raise ValueError (
202- "redis_password_secret must contain both 'name' and 'key' fields"
203- )
204-
205174 self ._validate_types ()
206175 self ._memory_to_string ()
207176 self ._validate_gpu_config (self .head_accelerators )
@@ -286,11 +255,6 @@ def build_ray_cluster_spec(self, cluster_name: str) -> Dict[str, Any]:
286255 "workerGroupSpecs" : [self ._build_worker_group_spec (cluster_name )],
287256 }
288257
289- # Add GCS fault tolerance if enabled
290- if self .enable_gcs_ft :
291- gcs_ft_options = self ._build_gcs_ft_options ()
292- ray_cluster_spec ["gcsFaultToleranceOptions" ] = gcs_ft_options
293-
294258 return ray_cluster_spec
295259
296260 def _build_head_group_spec (self ) -> Dict [str , Any ]:
@@ -494,31 +458,7 @@ def _build_env_vars(self) -> list:
494458 """Build environment variables list."""
495459 return [V1EnvVar (name = key , value = value ) for key , value in self .envs .items ()]
496460
497- def _build_gcs_ft_options (self ) -> Dict [str , Any ]:
498- """Build GCS fault tolerance options."""
499- gcs_ft_options = {"redisAddress" : self .redis_address }
500-
501- if (
502- hasattr (self , "external_storage_namespace" )
503- and self .external_storage_namespace
504- ):
505- gcs_ft_options ["externalStorageNamespace" ] = self .external_storage_namespace
506-
507- if hasattr (self , "redis_password_secret" ) and self .redis_password_secret :
508- gcs_ft_options ["redisPassword" ] = {
509- "valueFrom" : {
510- "secretKeyRef" : {
511- "name" : self .redis_password_secret ["name" ],
512- "key" : self .redis_password_secret ["key" ],
513- }
514- }
515- }
516-
517- return gcs_ft_options
518-
519- def add_script_volumes (
520- self , configmap_name : str , mount_path : str = "/home/ray/scripts"
521- ):
461+ def add_script_volumes (self , configmap_name : str , mount_path : str = MOUNT_PATH ):
522462 """
523463 Add script volume and mount references to cluster configuration.
524464
@@ -590,7 +530,7 @@ def build_script_configmap_spec(
590530 }
591531
592532 def build_script_volume_specs (
593- self , configmap_name : str , mount_path : str = "/home/ray/scripts"
533+ self , configmap_name : str , mount_path : str = MOUNT_PATH
594534 ) -> Tuple [Dict [str , Any ], Dict [str , Any ]]:
595535 """
596536 Build volume and mount specifications for scripts
0 commit comments