Skip to content

Commit a00d0aa

Browse files
alexdebrieJoshRosen
authored andcommitted
[SPARK-4745] Fix get_existing_cluster() function with multiple security groups
The current get_existing_cluster() function would only find an instance belonged to a cluster if the instance's security groups == cluster_name + "-master" (or "-slaves"). This fix allows for multiple security groups by checking if the cluster_name + "-master" security group is in the list of groups for a particular instance. Author: alexdebrie <[email protected]> Closes #3596 from alexdebrie/master and squashes the following commits: 9d51232 [alexdebrie] Fix get_existing_cluster() function with multiple security groups (cherry picked from commit 794f3ae) Signed-off-by: Josh Rosen <[email protected]>
1 parent bc05df8 commit a00d0aa

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

ec2/spark_ec2.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -506,9 +506,9 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
506506
active = [i for i in res.instances if is_active(i)]
507507
for inst in active:
508508
group_names = [g.name for g in inst.groups]
509-
if group_names == [cluster_name + "-master"]:
509+
if (cluster_name + "-master") in group_names:
510510
master_nodes.append(inst)
511-
elif group_names == [cluster_name + "-slaves"]:
511+
elif (cluster_name + "-slaves") in group_names:
512512
slave_nodes.append(inst)
513513
if any((master_nodes, slave_nodes)):
514514
print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes))

0 commit comments

Comments
 (0)