aboutsummaryrefslogtreecommitdiff
path: root/ec2
diff options
context:
space:
mode:
authorJosh Rosen <joshrosen@eecs.berkeley.edu>2012-11-03 17:02:47 -0700
committerJosh Rosen <joshrosen@eecs.berkeley.edu>2012-11-03 17:02:47 -0700
commit594eed31c43ecbefed069d827b388cdd54456277 (patch)
tree43629a369bff406dd215ced70fe2fea168ae736e /ec2
parent590e4aa9cb18648de5ddc943f03489273596b16c (diff)
downloadspark-594eed31c43ecbefed069d827b388cdd54456277.tar.gz
spark-594eed31c43ecbefed069d827b388cdd54456277.tar.bz2
spark-594eed31c43ecbefed069d827b388cdd54456277.zip
Fix check for existing instances during EC2 launch.
Diffstat (limited to 'ec2')
-rwxr-xr-xec2/spark_ec2.py16
1 files changed, 6 insertions, 10 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py
index c0926e214f..2ca4d8020d 100755
--- a/ec2/spark_ec2.py
+++ b/ec2/spark_ec2.py
@@ -180,16 +180,12 @@ def launch_cluster(conn, opts, cluster_name):
zoo_group.authorize('tcp', 3888, 3888, '0.0.0.0/0')
# Check if instances are already running in our groups
- print "Checking for running cluster..."
- reservations = conn.get_all_instances()
- for res in reservations:
- group_names = [g.id for g in res.groups]
- if master_group.name in group_names or slave_group.name in group_names or zoo_group.name in group_names:
- active = [i for i in res.instances if is_active(i)]
- if len(active) > 0:
- print >> stderr, ("ERROR: There are already instances running in " +
- "group %s, %s or %s" % (master_group.name, slave_group.name, zoo_group.name))
- sys.exit(1)
+ active_nodes = get_existing_cluster(conn, opts, cluster_name,
+ die_on_error=False)
+ if any(active_nodes):
+ print >> stderr, ("ERROR: There are already instances running in " +
+ "group %s, %s or %s" % (master_group.name, slave_group.name, zoo_group.name))
+ sys.exit(1)
# Figure out the latest AMI from our static URL
if opts.ami == "latest":