Skip to content

Improve template capabilities of EMR job and step operators - #8572

Merged
ashb merged 3 commits into
apache:masterfrom
oripwk:master
May 1, 2020
Merged

ashb merged 3 commits into
apache:masterfrom
oripwk:master

Conversation

@oripwk

@oripwk oripwk commented Apr 26, 2020 •

Copy link
Copy Markdown
Contributor

The EmrCreateJobFlowOperator and EmrAddStepsOperator operators already support receiving job_flow_overrides and steps arguments as templates. However, one of the benefits of templating is the ability to refer to a file, which is not currently supported. A good example of an existing operator which leverages file templates is BashOperator, which applies this principle to its bash_command parameter.

Adding such support will improve the usability of the operators greatly, since at the moment the only way to do it is manually invoking Jinja to read the files before passing the arguments to the operators.

This PR simply adds the proper file extensions to template_ext field, and converts the resulting string into a Python dictionary.


Make sure to mark the boxes below before creating PR: [x]

  • Description above provides context of the change
  • Unit tests coverage for changes (not needed for documentation changes)
  • Target Github ISSUE in description if exists
  • Commits follow "How to write a good git commit message"
  • Relevant documentation is updated including usage instructions.
  • I will engage committers as explained in Contribution Workflow Example.

In case of fundamental code change, Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in UPDATING.md.
Read the Pull Request Guidelines for more information.

@boring-cyborg boring-cyborg Bot added the provider:amazon AWS/Amazon - related issues label Apr 26, 2020
@boring-cyborg

boring-cyborg Bot commented Apr 26, 2020

Copy link
Copy Markdown

Congratulations on your first Pull Request and welcome to the Apache Airflow community! If you have any issues or are unsure about any anything please check our Contribution Guide (https://github.com/apache/airflow/blob/master/CONTRIBUTING.rst)
Here are some useful points:

@oripwk
oripwk force-pushed the master branch 3 times, most recently from 96875a0 to de4e8ef Compare April 27, 2020 18:40
oripwk added 2 commits April 28, 2020 10:58
Allow EmrCreateJobFlowOperator and EmrAddStepsOperator
to receive their 'job_flow_overrides', and 'steps'
arguments respectively as Jinja template filenames.
This is similar to BashOperator's capability of
receiving a filename as its 'bash_command' argument.
@ashb
ashb merged commit 4421f01 into apache:master May 1, 2020
@boring-cyborg

boring-cyborg Bot commented May 1, 2020

Copy link
Copy Markdown

Awesome work, congrats on your first merged pull request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

provider:amazon AWS/Amazon - related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants