Commit 6f6e124c by Gabe Mulley

Allow connections to named clusters

This way we can give clusters semantic names like "Production" and point the scheduler at those names instead of relying on the job flow ID which is not very human friendly / memorable.

Change-Id: Iebeab022e09047b625f4725300d357905555ef04
parent 2c932441
......@@ -10,7 +10,8 @@ import uuid
def main():
"""Parse arguments and run the remote task."""
parser = argparse.ArgumentParser()
parser.add_argument('--job-flow-id', help='EMR job flow to run the task')
parser.add_argument('--job-flow-id', help='EMR job flow to run the task', default=None)
parser.add_argument('--job-flow-name', help='EMR job flow to run the task', default=None)
parser.add_argument('--branch', help='git branch to checkout before running the task', default='release')
parser.add_argument('--repo', help='git repository to clone')
parser.add_argument('--remote-name', help='an identifier for this remote task')
......@@ -51,7 +52,7 @@ def convert_args_to_extra_vars(arguments, uid):
uid (str): A unique identifier for this task execution.
"""
extra_vars = {
'name': arguments.job_flow_id,
'name': arguments.job_flow_id or arguments.job_flow_name,
'branch': arguments.branch,
'task_arguments': ' '.join(arguments.launch_task_arguments) + ' >/tmp/{0}.out 2>/tmp/{0}.err'.format(uid),
'uuid': uid,
......
......@@ -374,7 +374,7 @@ class Ec2Inventory(object):
if k == 'ansible:groups':
for group in v.split(','):
self.push(self.inventory, group, dest)
elif k == 'aws:elasticmapreduce:job-flow-id':
elif k == 'aws:elasticmapreduce:job-flow-id' or k == 'ansible:emr:name':
role = instance.tags.get('aws:elasticmapreduce:instance-group-role')
if role:
self.push(self.inventory, 'mr_{name}_{role}'.format(name=v, role=role.lower()), dest)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment