aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicholas Chammas <nicholas.chammas@gmail.com>2015-03-07 12:33:41 +0000
committerSean Owen <sowen@cloudera.com>2015-03-07 12:33:41 +0000
commit2646794ffb2970618087e2e964d9f4c953e17e6a (patch)
treecc9cab091a0b05a6e453237c850c51e55ef51f1c
parent48a723c98684c5bb3d185cada4888cae952791bd (diff)
downloadspark-2646794ffb2970618087e2e964d9f4c953e17e6a.tar.gz
spark-2646794ffb2970618087e2e964d9f4c953e17e6a.tar.bz2
spark-2646794ffb2970618087e2e964d9f4c953e17e6a.zip
[EC2] Reorder print statements on termination
The PR reorders some print statements slightly on cluster termination so that they read better. For example, from this: ``` Are you sure you want to destroy the cluster spark-cluster-test? The following instances will be terminated: Searching for existing cluster spark-cluster-test in region us-west-2... Found 1 master(s), 2 slaves > ... ALL DATA ON ALL NODES WILL BE LOST!! Destroy cluster spark-cluster-test (y/N): ``` To this: ``` Searching for existing cluster spark-cluster-test in region us-west-2... Found 1 master(s), 2 slaves The following instances will be terminated: > ... ALL DATA ON ALL NODES WILL BE LOST!! Are you sure you want to destroy the cluster spark-cluster-test? (y/N) ``` Author: Nicholas Chammas <nicholas.chammas@gmail.com> Closes #4932 from nchammas/termination-print-order and squashes the following commits: c23711d [Nicholas Chammas] reorder prints on termination
-rwxr-xr-xec2/spark_ec2.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index c59ab565c6..dabb9fce40 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -1126,14 +1126,16 @@ def real_main():
setup_cluster(conn, master_nodes, slave_nodes, opts, True)
elif action == "destroy":
- print "Are you sure you want to destroy the cluster %s?" % cluster_name
- print "The following instances will be terminated:"
(master_nodes, slave_nodes) = get_existing_cluster(
conn, opts, cluster_name, die_on_error=False)
- for inst in master_nodes + slave_nodes:
- print "> %s" % inst.public_dns_name
- msg = "ALL DATA ON ALL NODES WILL BE LOST!!\nDestroy cluster %s (y/N): " % cluster_name
+ if any(master_nodes + slave_nodes):
+ print "The following instances will be terminated:"
+ for inst in master_nodes + slave_nodes:
+ print "> %s" % inst.public_dns_name
+ print "ALL DATA ON ALL NODES WILL BE LOST!!"
+
+ msg = "Are you sure you want to destroy the cluster {c}? (y/N) ".format(c=cluster_name)
response = raw_input(msg)
if response == "y":
print "Terminating master..."
@@ -1145,7 +1147,6 @@ def real_main():
# Delete security groups as well
if opts.delete_groups:
- print "Deleting security groups (this will take some time)..."
group_names = [cluster_name + "-master", cluster_name + "-slaves"]
wait_for_cluster_state(
conn=conn,
@@ -1153,6 +1154,7 @@ def real_main():
cluster_instances=(master_nodes + slave_nodes),
cluster_state='terminated'
)
+ print "Deleting security groups (this will take some time)..."
attempt = 1
while attempt <= 3:
print "Attempt %d" % attempt