@@ -1114,7 +1114,7 @@ def stop(
1114
1114
default = None ,
1115
1115
is_flag = True ,
1116
1116
help = 'Tear down all existing clusters.' )
1117
- @click .option ('--idle_minutes ' ,
1117
+ @click .option ('--idle-minutes ' ,
1118
1118
'-i' ,
1119
1119
type = int ,
1120
1120
default = None ,
@@ -1215,6 +1215,13 @@ def _filter(name, all_clusters):
1215
1215
return cluster_record
1216
1216
return None
1217
1217
1218
+ # Get GLOB cluster names
1219
+ glob_clusters = []
1220
+ for cluster in clusters :
1221
+ glob_cluster = global_user_state .get_glob_cluster_names (cluster )
1222
+ glob_clusters .extend (glob_cluster )
1223
+ clusters = list (set (glob_clusters ))
1224
+
1218
1225
all_clusters = global_user_state .get_clusters ()
1219
1226
for name in clusters :
1220
1227
record = _filter (name , all_clusters )
@@ -1407,7 +1414,8 @@ def _terminate_or_stop_clusters(
1407
1414
1408
1415
operation = 'Terminating' if terminate else 'Stopping'
1409
1416
if idle_minutes_to_autostop is not None :
1410
- operation = 'Scheduling auto-stop on'
1417
+ verb = 'Scheduling' if idle_minutes_to_autostop >= 0 else 'Cancelling'
1418
+ operation = f'{ verb } auto-stop on'
1411
1419
plural = 's' if len (to_down ) > 1 else ''
1412
1420
progress = rich_progress .Progress (transient = True )
1413
1421
task = progress .add_task (
@@ -1431,34 +1439,32 @@ def _terminate_or_stop(record):
1431
1439
f'{ colorama .Style .RESET_ALL } ' )
1432
1440
elif idle_minutes_to_autostop is not None :
1433
1441
cluster_status = backend_utils .get_status_from_cluster_name (name )
1434
- if cluster_status != global_user_state .ClusterStatus .UP :
1435
- message = (
1436
- f'{ colorama .Fore .GREEN } Scheduling autostop for cluster '
1437
- f'{ name } (status: { cluster_status .value } )... skipped'
1438
- f'{ colorama .Style .RESET_ALL } \n '
1439
- ' Auto-stop can only be scheduled on '
1440
- f'{ global_user_state .ClusterStatus .UP .value } cluster.' )
1441
- elif not isinstance (backend , backends .CloudVmRayBackend ):
1442
- message = (
1443
- f'{ colorama .Fore .GREEN } Scheduling auto-stop for cluster '
1444
- f'{ name } ... skipped{ colorama .Style .RESET_ALL } \n '
1445
- ' Auto-stopping is only supported by backend: '
1446
- f'{ backends .CloudVmRayBackend .NAME } ' )
1442
+ if not isinstance (backend , backends .CloudVmRayBackend ):
1443
+ message = (f'{ colorama .Fore .GREEN } { operation } cluster '
1444
+ f'{ name } ... skipped{ colorama .Style .RESET_ALL } '
1445
+ '\n Auto-stopping is only supported by backend: '
1446
+ f'{ backends .CloudVmRayBackend .NAME } ' )
1447
1447
else :
1448
- backend .set_autostop (handle , idle_minutes_to_autostop )
1449
- if idle_minutes_to_autostop < 0 :
1448
+ if cluster_status != global_user_state .ClusterStatus .UP :
1450
1449
message = (
1451
- f'{ colorama .Fore .GREEN } Cancelling auto-stop for '
1452
- f'cluster { name } ...done{ colorama .Style .RESET_ALL } ' )
1450
+ f'{ colorama .Fore .GREEN } { operation } cluster '
1451
+ f'{ name } (status: { cluster_status .value } )... skipped'
1452
+ f'{ colorama .Style .RESET_ALL } '
1453
+ '\n Auto-stop can only be run on '
1454
+ f'{ global_user_state .ClusterStatus .UP .value } cluster.' )
1453
1455
else :
1456
+ backend .set_autostop (handle , idle_minutes_to_autostop )
1454
1457
message = (
1455
- f'{ colorama .Fore .GREEN } Scheduling auto-stop for '
1456
- f'cluster { name } ...done{ colorama .Style .RESET_ALL } \n '
1457
- f' The cluster will be stopped after '
1458
- f'{ idle_minutes_to_autostop } minutes of idleness.\n '
1459
- ' To cancel the autostop, run: '
1460
- f'{ colorama .Style .BRIGHT } sky autostop { name } --cancel'
1461
- f'{ colorama .Style .RESET_ALL } ' )
1458
+ f'{ colorama .Fore .GREEN } { operation } '
1459
+ f'cluster { name } ...done{ colorama .Style .RESET_ALL } ' )
1460
+ if idle_minutes_to_autostop >= 0 :
1461
+ message += (
1462
+ f'\n The cluster will be stopped after '
1463
+ f'{ idle_minutes_to_autostop } minutes of idleness.'
1464
+ '\n To cancel the autostop, run: '
1465
+ f'{ colorama .Style .BRIGHT } '
1466
+ f'sky autostop { name } --cancel'
1467
+ f'{ colorama .Style .RESET_ALL } ' )
1462
1468
else :
1463
1469
success = backend .teardown (handle , terminate = terminate , purge = purge )
1464
1470
if success :
0 commit comments