Skip to content

Commit a3edc5e

Browse files
committed
fix get_cluster_id
1 parent 18229a6 commit a3edc5e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

centml/sdk/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,12 @@ def get_cserve_recipe(self, model=None, hf_token=None):
7171
return self._api.get_cserve_recipe_deployments_cserve_recipes_get(model=model, hf_token=hf_token).results
7272

7373
def get_cluster_id(self, hardware_instance_id):
74-
hardware_instance = list(filter(lambda h: h.id == hardware_instance_id, self.get_hardware_instances()))[0]
74+
filtered_hw = list(filter(lambda h: h.id == hardware_instance_id, self.get_hardware_instances()))
7575

76-
if len(hardware_instance) == 0:
76+
if len(filtered_hw) == 0:
7777
raise Exception(f"Invalid hardware instance id {hardware_instance_id}")
7878

79-
return hardware_instance.cluster_id
79+
return filtered_hw[0].cluster_id
8080

8181

8282
@contextmanager

0 commit comments

Comments
 (0)