Skip to content

Commit

Permalink
fix(Cluster):updated clusterinfo
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Apr 2, 2024
1 parent 34c9f9b commit a1bd460
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions simple_vm_client/bibigrid_connector/bibigrid_connector.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import requests
import yaml

from simple_vm_client.ttypes import ClusterInfo, ClusterInstance
from simple_vm_client.ttypes import (
ClusterInfo,
ClusterInstance,
ClusterNotFoundException,
)
from simple_vm_client.util.logger import setup_custom_logger

logger = setup_custom_logger(__name__)
Expand Down Expand Up @@ -94,8 +98,10 @@ def get_cluster_status(self, cluster_id: str) -> dict[str, str]:
def get_cluster_info(self, cluster_id: str) -> ClusterInfo:
logger.info(f"Get Cluster info from {cluster_id}")
infos: list[dict[str, str]] = self.get_clusters_info()
if infos == "No BiBiGrid cluster found!":
raise ClusterNotFoundException(message=f"Cluster {cluster_id} not found!")
for info in infos:
if info["cluster-id"] == cluster_id:
if info.get("cluster-id", "") == cluster_id:
cluster_info = ClusterInfo(
group_id=info["group-id"],
network_id=info["network-id"],
Expand All @@ -109,7 +115,7 @@ def get_cluster_info(self, cluster_id: str) -> ClusterInfo:
logger.info(f"Cluster {cluster_id} info: {cluster_info} ")

return cluster_info
return None
raise ClusterNotFoundException(message=f"Cluster {cluster_id} not found!")

def get_clusters_info(self) -> list[dict[str, str]]:
logger.info("Get clusters info")
Expand All @@ -126,7 +132,7 @@ def get_clusters_info(self) -> list[dict[str, str]]:
return infos

def is_bibigrid_available(self) -> bool:
logger.info(f"Checking if Bibigrid is available")
logger.info("Checking if Bibigrid is available")

if not self._BIBIGRID_EP:
logger.info("Bibigrid Url is not set")
Expand Down

0 comments on commit a1bd460

Please sign in to comment.