From 27b0a366062e6cbc4700ea2f37e31059561dc80b Mon Sep 17 00:00:00 2001 From: Jean-Martin Archer Date: Sat, 29 Mar 2014 18:13:32 -0700 Subject: [PATCH 1/2] Listing of instances to be terminated before the prompt Will list the EC2 instances before detroying the cluster. This was added because it can be scary to destroy EC2 instances without knowing which one will be impacted. --- ec2/spark_ec2.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index d8840c94ac17c..e25a4d7808f10 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -223,7 +223,7 @@ def launch_cluster(conn, opts, cluster_name): sys.exit(1) if opts.key_pair is None: print >> stderr, "ERROR: Must provide a key pair name (-k) to use on instances." - sys.exit(1) + sys.exit(1) print "Setting up security groups..." master_group = get_or_make_group(conn, cluster_name + "-master") slave_group = get_or_make_group(conn, cluster_name + "-slaves") @@ -691,12 +691,18 @@ def real_main(): setup_cluster(conn, master_nodes, slave_nodes, opts, True) elif action == "destroy": - response = raw_input("Are you sure you want to destroy the cluster " + - cluster_name + "?\nALL DATA ON ALL NODES WILL BE LOST!!\n" + + (master_nodes, slave_nodes) = get_existing_cluster( + conn, opts, cluster_name, die_on_error=False) + + print "Are you sure you want to destroy the cluster " + \ + cluster_name + "?\nThe following instances will be terminated:" + for inst in master_nodes + slave_nodes: + print inst + + response = raw_input("ALL DATA ON ALL NODES WILL BE LOST!!\n" + "Destroy cluster " + cluster_name + " (y/N): ") + if response == "y": - (master_nodes, slave_nodes) = get_existing_cluster( - conn, opts, cluster_name, die_on_error=False) print "Terminating master..." for inst in master_nodes: inst.terminate() From 826455f1928243e75215d33461a96ca43164be18 Mon Sep 17 00:00:00 2001 From: Jean-Martin Archer Date: Fri, 20 Jun 2014 23:13:29 -0700 Subject: [PATCH 2/2] [SPARK-2611] Implementing recommendations As per https://github.com/apache/spark/pull/270#issuecomment-46349745 --- ec2/spark_ec2.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index e25a4d7808f10..f92a048faf133 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -694,10 +694,10 @@ def real_main(): (master_nodes, slave_nodes) = get_existing_cluster( conn, opts, cluster_name, die_on_error=False) - print "Are you sure you want to destroy the cluster " + \ - cluster_name + "?\nThe following instances will be terminated:" + print "Are you sure you want to destroy the cluster %s?" % cluster_name + print "The following instances will be terminated:" for inst in master_nodes + slave_nodes: - print inst + print inst.public_dns_name response = raw_input("ALL DATA ON ALL NODES WILL BE LOST!!\n" + "Destroy cluster " + cluster_name + " (y/N): ")