Skip to content

Commit b3f747b

Browse files
committed
implemented get cluster
1 parent edb6006 commit b3f747b

2 files changed

Lines changed: 35 additions & 1 deletion

File tree

‎centml/sdk/config.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class Config(BaseSettings):
88
# It is possible to override the default values by setting the environment variables
99
model_config = SettingsConfigDict(env_file=Path(".env"))
1010

11-
CENTML_WEB_URL: str = os.getenv("CENTML_WEB_URL", default="http://localhost:5173")
11+
CENTML_WEB_URL: str = os.getenv("CENTML_WEB_URL", default="http://localhost:5173/")
1212
CENTML_CONFIG_PATH: str = os.getenv("CENTML_CONFIG_PATH", default=os.path.expanduser("~/.centml"))
1313
CENTML_CRED_FILE: str = os.getenv("CENTML_CRED_FILE", default="credentials.json")
1414
CENTML_CRED_FILE_PATH: str = os.path.join(CENTML_CONFIG_PATH, CENTML_CRED_FILE)

‎examples/sdk/get_clusters.py‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env python3
2+
"""
3+
Example: Get available clusters
4+
5+
This example demonstrates how to retrieve cluster information
6+
using the CentML SDK.
7+
"""
8+
9+
from centml.sdk.ops import get_centml_ops_client
10+
11+
12+
def main():
13+
"""Get and display cluster information"""
14+
print("Retrieving cluster information...")
15+
16+
with get_centml_ops_client() as ops_client:
17+
# Get all clusters
18+
clusters = ops_client.get_clusters()
19+
20+
if not clusters:
21+
print("No clusters found.")
22+
return
23+
24+
print(f"\nFound {len(clusters)} cluster(s):\n")
25+
26+
for cluster in clusters:
27+
print(f"Cluster ID: {cluster.id}")
28+
print(f" Display Name: {cluster.display_name}")
29+
print(f" Region: {cluster.region or 'N/A'}")
30+
print()
31+
32+
33+
if __name__ == "__main__":
34+
main()

0 commit comments

Comments
 (0)