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

Improve template capabilities of EMR job and step operators #8572

Merged
merged 3 commits into from May 1, 2020

Conversation

oripwk
Copy link
Contributor

@oripwk oripwk commented Apr 26, 2020

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 AWS/Amazon - related issues label Apr 26, 2020
@boring-cyborg
Copy link

boring-cyborg bot commented Apr 26, 2020

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:

  • Pay attention to the quality of your code (flake8, pylint and type annotations). Our pre-commits will help you with that.
  • In case of a new feature add useful documentation (in docstrings or in docs/ directory). Adding a new operator? Check this short guide Consider adding an example DAG that shows how users should use it.
  • Consider using Breeze environment for testing locally, it’s a heavy docker but it ships with a working Airflow and a lot of integrations.
  • Be patient and persistent. It might take some time to get a review or get the final approval from Committers.
  • Be sure to read the Airflow Coding style.
    Apache Airflow is a community-driven project and together we are making it better 🚀.
    In case of doubts contact the developers at:
    Mailing List: dev@airflow.apache.org
    Slack: https://apache-airflow-slack.herokuapp.com/

@oripwk oripwk force-pushed the master branch 3 times, most recently from 96875a0 to de4e8ef Compare April 27, 2020 18:40
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
Copy link

boring-cyborg bot commented May 1, 2020

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 AWS/Amazon - related issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants