Skip to content

Commit

Permalink
[SPARK-2065] give launched instances names
Browse files Browse the repository at this point in the history
This update gives launched EC2 instances descriptive names by using
instance tags. Launched instances now show up in the EC2 console with
these names.

I used `format()` with named parameters, which I believe is the
recommended practice for string formatting in Python, but which doesn’t
seem to be used elsewhere in the script.
  • Loading branch information
nchammas committed Jun 10, 2014
1 parent 69da6cf commit 6544b7e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ec2/spark_ec2.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,12 @@ def launch_cluster(conn, opts, cluster_name):
master_nodes = master_res.instances
print "Launched master in %s, regid = %s" % (zone, master_res.id)

# Give the instances descriptive names
for master in master_nodes:
master.add_tag(key='Name', value='spark-{cn}-master-{iid}'.format(cn=cluster_name, iid=master.id))
for slave in slave_nodes:
slave.add_tag(key='Name', value='spark-{cn}-slave-{iid}'.format(cn=cluster_name, iid=slave.id))

# Return all the instances
return (master_nodes, slave_nodes)

Expand Down

0 comments on commit 6544b7e

Please sign in to comment.