Skip to content

Commit 03eb92c

Browse files
authored
[Refactor] Remove duplicate definition of get_ray_cluster_status (#3608)
Signed-off-by: LeoLiao123 <[email protected]>
1 parent 2409109 commit 03eb92c

File tree

1 file changed

+0
-39
lines changed

1 file changed

+0
-39
lines changed

clients/python-client/python_client/kuberay_cluster_api.py

Lines changed: 0 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -105,45 +105,6 @@ def get_ray_cluster(self, name: str, k8s_namespace: str = "default") -> Any:
105105
log.error("error fetching custom resource: {}".format(e))
106106
return None
107107

108-
def get_ray_cluster_status(self, name: str, k8s_namespace: str = "default", timeout: int=60) -> Any:
109-
"""Get a specific Ray cluster in a given namespace.
110-
111-
Parameters:
112-
- name (str): The name of the Ray cluster custom resource. Defaults to "".
113-
- k8s_namespace (str, optional): The namespace in which to retrieve the Ray cluster. Defaults to "default".
114-
- timeout (int, optional): The duration in seconds after which we stop trying to get status. Defaults to 60 seconds.
115-
116-
117-
Returns:
118-
Any: The custom resource for the specified Ray cluster, or None if not found.
119-
120-
Raises:
121-
ApiException: If there was an error fetching the custom resource.
122-
"""
123-
for attempt in range(10):
124-
try:
125-
resource: Any = self.api.get_namespaced_custom_object_status(
126-
group=constants.GROUP,
127-
version=constants.VERSION,
128-
plural=constants.PLURAL,
129-
name=name,
130-
namespace=k8s_namespace,
131-
)
132-
except ApiException as e:
133-
if e.status == 404:
134-
log.error("raycluster resource is not found. error = {}".format(e))
135-
return None
136-
else:
137-
log.error("error fetching custom resource: {}".format(e))
138-
return None
139-
140-
if resource["status"]:
141-
return resource["status"]
142-
else:
143-
time.sleep(5)
144-
145-
return None
146-
147108
def get_ray_cluster_status(self, name: str, k8s_namespace: str = "default", timeout: int = 60, delay_between_attempts: int = 5) -> Any:
148109
"""Get a specific Ray cluster in a given namespace.
149110

0 commit comments

Comments
 (0)