python/ray/tests/kuberay/test_autoscaling_e2e.py
def _get_ray_cr_config(
        self, min_replicas=0, max_replicas=300, replicas=0
    ) -> Dict[str, Any]:
        """Get Ray CR config yaml.

        Use configurable replica fields for a CPU workerGroup.

        Also add a GPU-annotated group for testing GPU upscaling.
        """
        with open(self._get_ray_cr_config_file()) as ray_config_file:
            ray_config_str = ray_config_file.read()
        config = yaml.safe_load(ray_config_str)
        cpu_group = config["spec"]["workerGroupSpecs"][0]
        cpu_group["replicas"] = replicas
        cpu_group["minReplicas"] = min_replicas
        cpu_group["maxReplicas"] = max_replicas

        # Add a GPU-annotated group.
        # (We're not using real GPUs, just adding a GPU annotation for the autoscaler
        # and Ray scheduler.)
        gpu_group = copy.deepcopy(cpu_group)
        gpu_group["rayStartParams"]["num-gpus"] = "1"
        gpu_group["replicas"] = 0
        gpu_group["minReplicas"] = 0
        gpu_group["maxReplicas"] = 1
        gpu_group["groupName"] = "fake-gpu-group"
        config["spec"]["workerGroupSpecs"].append(gpu_group)

        return config
Get Ray CR config yaml.

        Use configurable replica fields for a CPU workerGroup.

        Also add a GPU-annotated group for testing GPU upscaling.
        
Get Ray CR config yaml.
Use configurable replica fields for a CPU workerGroup.

Also add a GPU-annotated group for testing GPU upscaling.
Get Ray CR config yaml . Use configurable replica fields for a CPU workerGroup . Also add a GPU - annotated group for testing GPU upscaling .
def _get_ray_cr_config(
        self, min_replicas=0, max_replicas=300, replicas=0
    ) -> Dict[str, Any]:
        with open(self._get_ray_cr_config_file()) as ray_config_file:
            ray_config_str = ray_config_file.read()
        config = yaml.safe_load(ray_config_str)
        cpu_group = config["spec"]["workerGroupSpecs"][0]
        cpu_group["replicas"] = replicas
        cpu_group["minReplicas"] = min_replicas
        cpu_group["maxReplicas"] = max_replicas
        gpu_group = copy.deepcopy(cpu_group)
        gpu_group["rayStartParams"]["num-gpus"] = "1"
        gpu_group["replicas"] = 0
        gpu_group["minReplicas"] = 0
        gpu_group["maxReplicas"] = 1
        gpu_group["groupName"] = "fake-gpu-group"
        config["spec"]["workerGroupSpecs"].append(gpu_group)
        return config
def _get_ray_cr_config ( self , min_replicas = 0 , max_replicas = 300 , replicas = 0 ) -> Dict [ str , Any ] : with open ( self . _get_ray_cr_config_file ( ) ) as ray_config_file : ray_config_str = ray_config_file . read ( ) config = yaml . safe_load ( ray_config_str ) cpu_group = config [ "spec" ] [ "workerGroupSpecs" ] [ 0 ] cpu_group [ "replicas" ] = replicas cpu_group [ "minReplicas" ] = min_replicas cpu_group [ "maxReplicas" ] = max_replicas gpu_group = copy . deepcopy ( cpu_group ) gpu_group [ "rayStartParams" ] [ "num-gpus" ] = "1" gpu_group [ "replicas" ] = 0 gpu_group [ "minReplicas" ] = 0 gpu_group [ "maxReplicas" ] = 1 gpu_group [ "groupName" ] = "fake-gpu-group" config [ "spec" ] [ "workerGroupSpecs" ] . append ( gpu_group ) return config
Get Ray CR config yaml.
Get Ray CR config yaml .
"""Get Ray CR config yaml.

        Use configurable replica fields for a CPU workerGroup.

        Also add a GPU-annotated group for testing GPU upscaling.
        """ # Add a GPU-annotated group. # (We're not using real GPUs, just adding a GPU annotation for the autoscaler # and Ray scheduler.)
self
min_replicas
max_replicas
replicas