Skip to content

Commit 9cb64b2

Browse files
Jean-Martin Archerpwendell
authored andcommitted
SPARK-2166 - 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. Author: Jean-Martin Archer <[email protected]> This patch had conflicts when merged, resolved by Committer: Patrick Wendell <[email protected]> Closes apache#270 from j-martin/master and squashes the following commits: 826455f [Jean-Martin Archer] [SPARK-2611] Implementing recommendations 27b0a36 [Jean-Martin Archer] 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.
1 parent 9fc373e commit 9cb64b2

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

ec2/spark_ec2.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -770,12 +770,16 @@ def real_main():
770770
setup_cluster(conn, master_nodes, slave_nodes, opts, True)
771771

772772
elif action == "destroy":
773-
response = raw_input("Are you sure you want to destroy the cluster " +
774-
cluster_name + "?\nALL DATA ON ALL NODES WILL BE LOST!!\n" +
775-
"Destroy cluster " + cluster_name + " (y/N): ")
773+
print "Are you sure you want to destroy the cluster %s?" % cluster_name
774+
print "The following instances will be terminated:"
775+
(master_nodes, slave_nodes) = get_existing_cluster(
776+
conn, opts, cluster_name, die_on_error=False)
777+
for inst in master_nodes + slave_nodes:
778+
print "> %s" % inst.public_dns_name
779+
780+
msg = "ALL DATA ON ALL NODES WILL BE LOST!!\nDestroy cluster %s (y/N): " % cluster_name
781+
response = raw_input(msg)
776782
if response == "y":
777-
(master_nodes, slave_nodes) = get_existing_cluster(
778-
conn, opts, cluster_name, die_on_error=False)
779783
print "Terminating master..."
780784
for inst in master_nodes:
781785
inst.terminate()

0 commit comments

Comments
 (0)