From 33f174187e41850d512af3dc8ad97a0239e307b0 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Wed, 18 Feb 2026 22:12:31 -0800 Subject: [PATCH 1/6] update: get clusters --- pyproject.toml | 1 + src/py/mat3ra/api_client/client.py | 2 + .../mat3ra/api_client/endpoints/clusters.py | 40 +++++++++++++++++++ 3 files changed, 43 insertions(+) create mode 100644 src/py/mat3ra/api_client/endpoints/clusters.py diff --git a/pyproject.toml b/pyproject.toml index 6147ed4..37c672d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ dependencies = [ "requests>=2.26.0", "pydantic>=2,<3", + "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@b3efa04a84755942a76dd1a2c3964f52e7307ba0", ] [project.optional-dependencies] diff --git a/src/py/mat3ra/api_client/client.py b/src/py/mat3ra/api_client/client.py index 00914aa..1299e27 100644 --- a/src/py/mat3ra/api_client/client.py +++ b/src/py/mat3ra/api_client/client.py @@ -8,6 +8,7 @@ from .constants import ACCESS_TOKEN_ENV_VAR, _build_base_url from .endpoints.bank_materials import BankMaterialEndpoints from .endpoints.bank_workflows import BankWorkflowEndpoints +from .endpoints.clusters import ClustersEndpoint from .endpoints.jobs import JobEndpoints from .endpoints.materials import MaterialEndpoints from .endpoints.metaproperties import MetaPropertiesEndpoints @@ -59,6 +60,7 @@ def _init_endpoints(self, timeout_seconds: int) -> None: self.metaproperties = MetaPropertiesEndpoints(*base_args, **base_kwargs) self.bank_materials = BankMaterialEndpoints(*base_args, **base_kwargs) self.bank_workflows = BankWorkflowEndpoints(*base_args, **base_kwargs) + self.clusters = ClustersEndpoint(*base_args, **base_kwargs) @staticmethod def _resolve_config( diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py new file mode 100644 index 0000000..aa92287 --- /dev/null +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -0,0 +1,40 @@ +from typing import List + +from mat3ra.ide import Cluster + +from . import BaseEndpoint +from .enums import DEFAULT_API_VERSION, SECURE + + +class ClustersEndpoint(BaseEndpoint): + """ + Clusters endpoints for infrastructure access. + + Args: + host (str): API hostname. + port (int): API port number. + account_id (str): account ID. + auth_token (str): authentication token. + version (str): API version. + secure (bool): whether to use secure http protocol (https vs http). + kwargs (dict): a dictionary of HTTP session options. + timeout (int): session timeout in seconds. + + Attributes: + name (str): endpoint name. + headers (dict): default HTTP headers. + """ + + def __init__(self, host, port, account_id, auth_token, version=DEFAULT_API_VERSION, secure=SECURE, **kwargs): + super(ClustersEndpoint, self).__init__(host, port, version, secure, **kwargs) + self.headers = self.get_headers(account_id, auth_token) + + def list(self) -> List[Cluster]: + """ + Returns a list of available clusters. + + Returns: + list[Cluster]: List of Cluster objects with fqdn set to the cluster hostname. + """ + response = self.request("GET", "infrastructure/clusters", headers=self.headers) + return [Cluster(fqdn=cluster_data["hostname"]) for cluster_data in response] From 70906213cdb200504c68f496ae97c5cf2d772ac4 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 19 Feb 2026 14:15:49 -0800 Subject: [PATCH 2/6] update: use new ide classes --- pyproject.toml | 2 +- src/py/mat3ra/api_client/endpoints/clusters.py | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 37c672d..fdc10d1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ dependencies = [ "requests>=2.26.0", "pydantic>=2,<3", - "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@b3efa04a84755942a76dd1a2c3964f52e7307ba0", + "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@0d3fb638f12b261e9072c2b97e0fd6f0b231076a", ] [project.optional-dependencies] diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py index aa92287..595a089 100644 --- a/src/py/mat3ra/api_client/endpoints/clusters.py +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -31,10 +31,11 @@ def __init__(self, host, port, account_id, auth_token, version=DEFAULT_API_VERSI def list(self) -> List[Cluster]: """ - Returns a list of available clusters. + Returns a list of available clusters with their queues. Returns: - list[Cluster]: List of Cluster objects with fqdn set to the cluster hostname. + list[Cluster]: Cluster objects with fqdn and Queue objects for available queues. """ response = self.request("GET", "infrastructure/clusters", headers=self.headers) - return [Cluster(fqdn=cluster_data["hostname"]) for cluster_data in response] + return [Cluster.from_config(cluster_data) for cluster_data in response] + From 141d7dba220f07844e97557dda3ee74087b38c31 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 19 Feb 2026 14:33:47 -0800 Subject: [PATCH 3/6] update: corrections --- pyproject.toml | 2 +- src/py/mat3ra/api_client/endpoints/clusters.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index fdc10d1..110f5c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,7 @@ classifiers = [ dependencies = [ "requests>=2.26.0", "pydantic>=2,<3", - "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@0d3fb638f12b261e9072c2b97e0fd6f0b231076a", + "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@5aa105e705c878ccaa8339828ee630bb391c4bd5", ] [project.optional-dependencies] diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py index 595a089..650f105 100644 --- a/src/py/mat3ra/api_client/endpoints/clusters.py +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -37,5 +37,5 @@ def list(self) -> List[Cluster]: list[Cluster]: Cluster objects with fqdn and Queue objects for available queues. """ response = self.request("GET", "infrastructure/clusters", headers=self.headers) - return [Cluster.from_config(cluster_data) for cluster_data in response] + return [Cluster.from_api_data(cluster_data) for cluster_data in response] From c57a6d09c1a41f66a332acf24ca5dd44b91e8b8a Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Wed, 25 Feb 2026 18:01:57 -0800 Subject: [PATCH 4/6] update: return simple json --- pyproject.toml | 1 - src/py/mat3ra/api_client/endpoints/clusters.py | 8 +++----- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 110f5c9..6147ed4 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,7 +23,6 @@ classifiers = [ dependencies = [ "requests>=2.26.0", "pydantic>=2,<3", - "mat3ra-ide @ git+https://github.com/Exabyte-io/ide.git@5aa105e705c878ccaa8339828ee630bb391c4bd5", ] [project.optional-dependencies] diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py index 650f105..456ebd3 100644 --- a/src/py/mat3ra/api_client/endpoints/clusters.py +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -29,13 +29,11 @@ def __init__(self, host, port, account_id, auth_token, version=DEFAULT_API_VERSI super(ClustersEndpoint, self).__init__(host, port, version, secure, **kwargs) self.headers = self.get_headers(account_id, auth_token) - def list(self) -> List[Cluster]: + def list(self): """ Returns a list of available clusters with their queues. Returns: - list[Cluster]: Cluster objects with fqdn and Queue objects for available queues. + list[Dict]: Cluster information, including queues. """ - response = self.request("GET", "infrastructure/clusters", headers=self.headers) - return [Cluster.from_api_data(cluster_data) for cluster_data in response] - + return self.request("GET", "infrastructure/clusters", headers=self.headers) From b30965041557d9e27fcfca1f1bd26726910a9e63 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Wed, 25 Feb 2026 18:04:29 -0800 Subject: [PATCH 5/6] chre: lint --- src/py/mat3ra/api_client/endpoints/clusters.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py index 456ebd3..75adc46 100644 --- a/src/py/mat3ra/api_client/endpoints/clusters.py +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -1,7 +1,3 @@ -from typing import List - -from mat3ra.ide import Cluster - from . import BaseEndpoint from .enums import DEFAULT_API_VERSION, SECURE From 827044e3b350af4b32e7cc8d64b28354c900f4a9 Mon Sep 17 00:00:00 2001 From: VsevolodX Date: Thu, 26 Feb 2026 10:42:37 -0800 Subject: [PATCH 6/6] chore: rename to other --- src/py/mat3ra/api_client/endpoints/clusters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/py/mat3ra/api_client/endpoints/clusters.py b/src/py/mat3ra/api_client/endpoints/clusters.py index 75adc46..d8e58ed 100644 --- a/src/py/mat3ra/api_client/endpoints/clusters.py +++ b/src/py/mat3ra/api_client/endpoints/clusters.py @@ -32,4 +32,4 @@ def list(self): Returns: list[Dict]: Cluster information, including queues. """ - return self.request("GET", "infrastructure/clusters", headers=self.headers) + return self.request("GET", "other/clusters", headers=self.headers)