@@ -29,23 +29,27 @@ def create_cluster_example():
2929 # Get SSH keys
3030 ssh_keys = [key .id for key in verda .ssh_keys .get ()]
3131
32+ cluster_type = '16B200'
33+ cluster_image = 'ubuntu-24.04-cuda-13.0-cluster'
34+ location_code = Locations .FIN_03
35+
3236 # Check if cluster type is available
33- if not verda .clusters .is_available ('16B200' , Locations . FIN_03 ):
34- raise ValueError ('Cluster type 16B200 is not available in FIN_03 ' )
37+ if not verda .clusters .is_available (cluster_type , location_code ):
38+ raise ValueError (f 'Cluster type { cluster_type } is not available in { location_code } ' )
3539
3640 # Get available images for cluster type
37- images = verda .clusters .get_cluster_images ('16B200' )
38- if 'ubuntu-22.04-cuda-12.9-cluster' not in images :
39- raise ValueError ('Ubuntu 22.04 CUDA 12.9 cluster image is not supported for 16B200 ' )
41+ images = verda .clusters .get_cluster_images (cluster_type )
42+ if cluster_image not in images :
43+ raise ValueError (f'Cluster image { cluster_image } is not supported for { cluster_type } ' )
4044
41- # Create a 16B200 cluster
45+ # Create a cluster
4246 cluster = verda .clusters .create (
4347 hostname = 'my-compute-cluster' ,
44- cluster_type = '16B200' ,
45- image = 'ubuntu-22.04-cuda-12.9-cluster' ,
48+ cluster_type = cluster_type ,
49+ image = cluster_image ,
4650 description = 'Example compute cluster for distributed training' ,
4751 ssh_key_ids = ssh_keys ,
48- location = Locations . FIN_03 ,
52+ location = location_code ,
4953 shared_volume_name = 'my-shared-volume' ,
5054 shared_volume_size = 30000 ,
5155 wait_for_status = None ,
@@ -59,8 +63,8 @@ def create_cluster_example():
5963
6064 # Wait for cluster to enter RUNNING status
6165 while cluster .status != ClusterStatus .RUNNING :
62- time .sleep (30 )
6366 print (f'Waiting for cluster to enter RUNNING status... (status: { cluster .status } )' )
67+ time .sleep (3 )
6468 cluster = verda .clusters .get_by_id (cluster .id )
6569
6670 print (f'Public IP: { cluster .ip } ' )
@@ -100,7 +104,13 @@ def get_cluster_by_id_example(cluster_id: str):
100104 print (f' Created at: { cluster .created_at } ' )
101105 print (f' Public IP: { cluster .ip } ' )
102106 print (f' Worker nodes: { len (cluster .worker_nodes )} ' )
103-
107+ for node in cluster .worker_nodes :
108+ print (f' - { node .hostname } ({ node .id } ): { node .status } , private IP: { node .private_ip } ' )
109+ print (f' Shared volumes: { len (cluster .shared_volumes )} ' )
110+ for volume in cluster .shared_volumes :
111+ print (
112+ f' - { volume .name } ({ volume .id } ): { volume .size_in_gigabytes } GB, mounted at { volume .mount_point } '
113+ )
104114 return cluster
105115
106116
0 commit comments