Skip to content
Snippets Groups Projects
Commit 594eed31 authored by Josh Rosen's avatar Josh Rosen
Browse files

Fix check for existing instances during EC2 launch.

parent 590e4aa9
No related branches found
No related tags found
No related merge requests found
...@@ -180,16 +180,12 @@ def launch_cluster(conn, opts, cluster_name): ...@@ -180,16 +180,12 @@ def launch_cluster(conn, opts, cluster_name):
zoo_group.authorize('tcp', 3888, 3888, '0.0.0.0/0') zoo_group.authorize('tcp', 3888, 3888, '0.0.0.0/0')
# Check if instances are already running in our groups # Check if instances are already running in our groups
print "Checking for running cluster..." active_nodes = get_existing_cluster(conn, opts, cluster_name,
reservations = conn.get_all_instances() die_on_error=False)
for res in reservations: if any(active_nodes):
group_names = [g.id for g in res.groups] print >> stderr, ("ERROR: There are already instances running in " +
if master_group.name in group_names or slave_group.name in group_names or zoo_group.name in group_names: "group %s, %s or %s" % (master_group.name, slave_group.name, zoo_group.name))
active = [i for i in res.instances if is_active(i)] sys.exit(1)
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)
# Figure out the latest AMI from our static URL # Figure out the latest AMI from our static URL
if opts.ami == "latest": if opts.ami == "latest":
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment