@@ -52,7 +52,7 @@ class UsageError(Exception):
52
52
def parse_args ():
53
53
parser = OptionParser (
54
54
usage = "spark-ec2 [options] <action> <cluster_name>"
55
- + "\n \n <action> can be: launch, destroy, login, stop, start, get-master" ,
55
+ + "\n \n <action> can be: launch, destroy, login, stop, start, get-master, reboot-slaves " ,
56
56
add_help_option = False )
57
57
parser .add_option (
58
58
"-h" , "--help" , action = "help" ,
@@ -950,6 +950,20 @@ def real_main():
950
950
subprocess .check_call (
951
951
ssh_command (opts ) + proxy_opt + ['-t' , '-t' , "%s@%s" % (opts .user , master )])
952
952
953
+ elif action == "reboot-slaves" :
954
+ response = raw_input (
955
+ "Are you sure you want to reboot the cluster " +
956
+ cluster_name + " slaves?\n " +
957
+ "Reboot cluster slaves " + cluster_name + " (y/N): " )
958
+ if response == "y" :
959
+ (master_nodes , slave_nodes ) = get_existing_cluster (
960
+ conn , opts , cluster_name , die_on_error = False )
961
+ print "Rebooting slaves..."
962
+ for inst in slave_nodes :
963
+ if inst .state not in ["shutting-down" , "terminated" ]:
964
+ print "Rebooting " + inst .id
965
+ inst .reboot ()
966
+
953
967
elif action == "get-master" :
954
968
(master_nodes , slave_nodes ) = get_existing_cluster (conn , opts , cluster_name )
955
969
print master_nodes [0 ].public_dns_name
0 commit comments