Repository: spark Updated Branches: refs/heads/master c48b6222e -> a2052a44f
[SPARK-2065] give launched instances names This update resolves [SPARK-2065](https://issues.apache.org/jira/browse/SPARK-2065). It 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. Author: Nicholas Chammas <nicholas.cham...@gmail.com> Author: nchammas <nicholas.cham...@gmail.com> Closes #1043 from nchammas/master and squashes the following commits: 69f6e22 [Nicholas Chammas] PEP8 fixes 2627247 [Nicholas Chammas] broke up lines before they hit 100 chars 6544b7e [Nicholas Chammas] [SPARK-2065] give launched instances names 69da6cf [nchammas] Merge pull request #1 from apache/master Project: http://git-wip-us.apache.org/repos/asf/spark/repo Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/a2052a44 Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/a2052a44 Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/a2052a44 Branch: refs/heads/master Commit: a2052a44f3c08076d8d1ac505c8eb5395141bf79 Parents: c48b622 Author: Nicholas Chammas <nicholas.cham...@gmail.com> Authored: Tue Jun 10 21:49:08 2014 -0700 Committer: Reynold Xin <r...@apache.org> Committed: Tue Jun 10 21:49:08 2014 -0700 ---------------------------------------------------------------------- ec2/spark_ec2.py | 11 +++++++++++ 1 file changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/spark/blob/a2052a44/ec2/spark_ec2.py ---------------------------------------------------------------------- diff --git a/ec2/spark_ec2.py b/ec2/spark_ec2.py index 9d5748b..52a89cb 100755 --- a/ec2/spark_ec2.py +++ b/ec2/spark_ec2.py @@ -200,6 +200,7 @@ def get_spark_shark_version(opts): sys.exit(1) return (version, spark_shark_map[version]) + # Attempt to resolve an appropriate AMI given the architecture and # region of the request. def get_spark_ami(opts): @@ -418,6 +419,16 @@ 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)