You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by rx...@apache.org on 2014/09/16 06:10:01 UTC

git commit: [SPARK-3540] Add reboot-slaves functionality to the ec2 script

Repository: spark
Updated Branches:
  refs/heads/master 60050f428 -> d428ac6a2


[SPARK-3540] Add reboot-slaves functionality to the ec2 script

Tested on a real cluster.

Author: Reynold Xin <rx...@apache.org>

Closes #2404 from rxin/ec2-reboot-slaves and squashes the following commits:

00a2dbd [Reynold Xin] Allow rebooting slaves.


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/d428ac6a
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/d428ac6a
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/d428ac6a

Branch: refs/heads/master
Commit: d428ac6a221d2dce19c43442abf197f2ade6658f
Parents: 60050f4
Author: Reynold Xin <rx...@apache.org>
Authored: Mon Sep 15 21:09:58 2014 -0700
Committer: Reynold Xin <rx...@apache.org>
Committed: Mon Sep 15 21:09:58 2014 -0700

----------------------------------------------------------------------
 ec2/spark_ec2.py | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/d428ac6a/ec2/spark_ec2.py
----------------------------------------------------------------------
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index bfd0759..5682e96 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -52,7 +52,7 @@ class UsageError(Exception):
 def parse_args():
     parser = OptionParser(
         usage="spark-ec2 [options] <action> <cluster_name>"
-        + "\n\n<action> can be: launch, destroy, login, stop, start, get-master",
+        + "\n\n<action> can be: launch, destroy, login, stop, start, get-master, reboot-slaves",
         add_help_option=False)
     parser.add_option(
         "-h", "--help", action="help",
@@ -950,6 +950,20 @@ def real_main():
         subprocess.check_call(
             ssh_command(opts) + proxy_opt + ['-t', '-t', "%s@%s" % (opts.user, master)])
 
+    elif action == "reboot-slaves":
+        response = raw_input(
+            "Are you sure you want to reboot the cluster " +
+            cluster_name + " slaves?\n" +
+            "Reboot cluster slaves " + cluster_name + " (y/N): ")
+        if response == "y":
+            (master_nodes, slave_nodes) = get_existing_cluster(
+                conn, opts, cluster_name, die_on_error=False)
+            print "Rebooting slaves..."
+            for inst in slave_nodes:
+                if inst.state not in ["shutting-down", "terminated"]:
+                    print "Rebooting " + inst.id
+                    inst.reboot()
+
     elif action == "get-master":
         (master_nodes, slave_nodes) = get_existing_cluster(conn, opts, cluster_name)
         print master_nodes[0].public_dns_name


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org