Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SPARK-3332 - Tags shouldn't be the main strategy for machine membership on clusters #2223

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions ec2/spark_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -508,10 +508,16 @@ def get_existing_cluster(conn, opts, cluster_name, die_on_error=True):
for res in reservations:
active = [i for i in res.instances if is_active(i)]
for inst in active:
group_names = [g.name for g in inst.groups]
name = inst.tags.get(u'Name', "")
if name.startswith(cluster_name + "-master"):
master_name = cluster_name + "-master"
slave_name = cluster_name + "-slave"
# Check by tag name is required when --security-group-prefix flag is used
# but it's not failsafe, so also check by group name
# which is a more solid strategy in the general case
if name.startswith(master_name) or master_name in group_names:
master_nodes.append(inst)
elif name.startswith(cluster_name + "-slave"):
elif name.startswith(slave_name) or slave_name + 's' 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)))
Expand Down Expand Up @@ -597,7 +603,6 @@ def get_num_disks(instance_type):
"m1.medium": 1,
"m1.large": 2,
"m1.xlarge": 4,
"t1.micro": 1,
"c1.medium": 1,
"c1.xlarge": 4,
"m2.xlarge": 1,
Expand Down