File tree 1 file changed +10
-8
lines changed
src/_nebari/provider/cloud
1 file changed +10
-8
lines changed Original file line number Diff line number Diff line change @@ -52,19 +52,21 @@ def regions() -> Set[str]:
52
52
53
53
54
54
@functools .lru_cache ()
55
- def instances (region : str ) -> Set [str ]:
55
+ def instances (region : str ) -> set [str ]:
56
56
"""Return a set of available compute instances in a region."""
57
57
credentials , project_id = load_credentials ()
58
58
zones_client = compute_v1 .services .region_zones .RegionZonesClient (
59
59
credentials = credentials
60
60
)
61
- instances_client = compute_v1 .InstancesClient (credentials = credentials )
62
-
63
- return {
64
- instance .machine_type .split ("/" )[- 1 ]
65
- for zone in zones_client .list (project = project_id , region = region )
66
- for instance in instances_client .list (project = project_id , zone = zone .name )
67
- }
61
+ instances_client = compute_v1 .MachineTypesClient (credentials = credentials )
62
+ zone_list = zones_client .list (project = project_id , region = region )
63
+ zones = [zone for zone in zone_list ]
64
+ instance_set : set [str ] = set ()
65
+ for zone in zones :
66
+ instance_list = instances_client .list (project = project_id , zone = zone .name )
67
+ for instance in instance_list :
68
+ instance_set .add (instance .name )
69
+ return instance_set
68
70
69
71
70
72
@functools .lru_cache ()
You can’t perform that action at this time.
0 commit comments