Skip to content

Commit

Permalink
use node provider kubernetes http client
Browse files Browse the repository at this point in the history
Signed-off-by: wa101 <wadhah.mahroug15@gmail.com>
  • Loading branch information
wadhah101 committed Nov 1, 2024
1 parent 203d74a commit a295db4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions python/ray/autoscaler/_private/kuberay/autoscaling_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,10 @@ class AutoscalingConfigProducer:
"""

def __init__(self, ray_cluster_name, ray_cluster_namespace):
self._ray_cr_path = f"rayclusters/{ray_cluster_name}"

self.kubernetes_api_client = node_provider.KubernetesHttpApiClient(
namespace=ray_cluster_namespace
)
self._ray_cr_path = f"rayclusters/{ray_cluster_name}"

def __call__(self):
ray_cr = self._fetch_ray_cr_from_k8s_with_retries()
Expand All @@ -68,7 +67,7 @@ def _fetch_ray_cr_from_k8s_with_retries(self) -> Dict[str, Any]:
"""
for i in range(1, MAX_RAYCLUSTER_FETCH_TRIES + 1):
try:
return self._fetch_ray_cr_from_k8s()
return self.kubernetes_api_client.get(self._ray_cr_path)
except requests.HTTPError as e:
if i < MAX_RAYCLUSTER_FETCH_TRIES:
logger.exception(
Expand All @@ -81,10 +80,6 @@ def _fetch_ray_cr_from_k8s_with_retries(self) -> Dict[str, Any]:
# This branch is inaccessible. Raise to satisfy mypy.
raise AssertionError

def _fetch_ray_cr_from_k8s(self) -> Dict[str, Any]:
result = self.kubernetes_api_client.get(self._ray_cr_path)
return result


def _derive_autoscaling_config_from_ray_cr(ray_cr: Dict[str, Any]) -> Dict[str, Any]:
provider_config = _generate_provider_config(ray_cr["metadata"]["namespace"])
Expand Down

0 comments on commit a295db4

Please sign in to comment.