diff options
author | alexdebrie <alexdebrie1@gmail.com> | 2014-12-04 14:13:59 -0800 |
---|---|---|
committer | Josh Rosen <joshrosen@databricks.com> | 2014-12-04 14:14:39 -0800 |
commit | 794f3aec24acb578e258532ad0590554d07958ba (patch) | |
tree | 4266dc252a4a42b14838cdee13c0dd2e47fb607e /ec2/spark_ec2.py | |
parent | 8dae26f83818ee0f5ce8e5b083625170d2e901c5 (diff) | |
download | spark-794f3aec24acb578e258532ad0590554d07958ba.tar.gz spark-794f3aec24acb578e258532ad0590554d07958ba.tar.bz2 spark-794f3aec24acb578e258532ad0590554d07958ba.zip |
[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 <alexdebrie1@gmail.com>
Closes #3596 from alexdebrie/master and squashes the following commits:
9d51232 [alexdebrie] Fix get_existing_cluster() function with multiple security groups
Diffstat (limited to 'ec2/spark_ec2.py')
-rwxr-xr-x | ec2/spark_ec2.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index b83decadc2..5f9e484212 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -504,9 +504,9 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True): active = [i for i in res.instances if is_active(i)] for inst in active: group_names = [g.name for g in inst.groups] - if group_names == [cluster_name + "-master"]: + if (cluster_name + "-master") in group_names: master_nodes.append(inst) - elif group_names == [cluster_name + "-slaves"]: + elif (cluster_name + "-slaves") in group_names: slave_nodes.append(inst) if any((master_nodes, slave_nodes)): print "Found %d master(s), %d slaves" % (len(master_nodes), len(slave_nodes)) |