Skip to content

Commit

Permalink
bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
venkatajagannath committed Jul 21, 2024
1 parent b64e7b6 commit 1778df0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion ray_provider/operators/ray.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def __init__(
use_gpu: bool = False,
kuberay_version: str = "1.0.0",
gpu_device_plugin_yaml: str = "https://raw.githubusercontent.com/NVIDIA/k8s-device-plugin/v0.9.0/nvidia-device-plugin.yml",
update_if_exists: bool = False,
**kwargs: Any,
) -> None:
super().__init__(**kwargs)
Expand All @@ -43,6 +44,7 @@ def __init__(
self.use_gpu = use_gpu
self.kuberay_version = kuberay_version
self.gpu_device_plugin_yaml = gpu_device_plugin_yaml
self.update_if_exists = update_if_exists

self._validate_yaml_file(ray_cluster_yaml)

Expand Down Expand Up @@ -71,7 +73,7 @@ def _create_or_update_cluster(
try:
self.hook.get_custom_object(group=group, version=version, plural=plural, name=name, namespace=namespace)
self.log.info(f"Updating existing Ray cluster: {name}")
self.hook.patch_custom_object(
self.hook.custom_object_client.patch_namespaced_custom_object(
group=group, version=version, namespace=namespace, plural=plural, name=name, body=cluster_spec
)
except client.exceptions.ApiException as e:
Expand Down
2 changes: 1 addition & 1 deletion tests/operators/test_ray_operators.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def test_create_or_update_cluster_update(self, mock_hook, operator):
operator.hook = mock_hook
operator._create_or_update_cluster("test_group", "v1", "rayclusters", "test-cluster", "default", {})

mock_hook.patch_custom_object.assert_called_once()
mock_hook.custom_object_client.patch_namespaced_custom_object.assert_called_once()

def test_setup_gpu_driver(self, mock_hook, operator):
mock_hook.load_yaml_content.return_value = {"metadata": {"name": "gpu-plugin"}}
Expand Down

0 comments on commit 1778df0

Please sign in to comment.