You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2019/12/28 16:46:00 UTC

[jira] [Commented] (AIRFLOW-5763) Run batches of (self-terminating) EMR JobFlows

    [ https://issues.apache.org/jira/browse/AIRFLOW-5763?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17004521#comment-17004521 ] 

ASF GitHub Bot commented on AIRFLOW-5763:
-----------------------------------------

stale[bot] commented on pull request #6281: Run batches of (self-terminating) EMR JobFlows [AIRFLOW-5763]
URL: https://github.com/apache/airflow/pull/6281
 
 
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> Run batches of (self-terminating) EMR JobFlows
> ----------------------------------------------
>
>                 Key: AIRFLOW-5763
>                 URL: https://issues.apache.org/jira/browse/AIRFLOW-5763
>             Project: Apache Airflow
>          Issue Type: New Feature
>          Components: aws
>    Affects Versions: 1.10.7
>            Reporter: Throw Away
>            Priority: Trivial
>
> [https://github.com/apache/airflow/pull/6281]
> > Make sure you have checked _all_ steps below.
> > 
> > ### Jira
> > * [x] My PR addresses the following [Airflow Jira](https://issues.apache.org/jira/browse/AIRFLOW/) issues and references them in the PR title. For example, "[AIRFLOW-XXX] My Airflow PR"
> > 
> > * https://issues.apache.org/jira/browse/AIRFLOW-XXX
> > * ~In case you are fixing a typo in the documentation you can prepend your commit with [AIRFLOW-XXX], code changes always need a Jira issue.~
> > * ~In case you are proposing a fundamental code change, you need to create an Airflow Improvement Proposal ([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals)).~
> > * ~In case you are adding a dependency, check if the license complies with the [ASF 3rd Party License Policy](https://www.apache.org/legal/resolved.html#category-x).~
> > 
> > ### Description
> > * [x] Here are some details about my PR, ~including screenshots of any UI changes:~
> > 
> > Run batches of (self-terminating) EMR JobFlows [AIRFLOW-XXX]
> > 
> > ## What is this:
> > This commit introduces an implementation of an `EmrRunJobFlows` operator
> > that allows Airflow to manage the execution of multiple EMR clusters.
> > The clusters are all configured through a Jinja template ahead of time,
> > just like `EmrCreateJobFlowOperator` but are submitted one batch of
> > clusters at a time, allowing for workflows that require sequences of
> > parallel clusters. The operator assumes that all the clusters it
> > manages auto-terminate.
> > 
> > As demonstrated in the unit test, with this operator the following
> > batches of EMR clusters could be set up:
> > 
> > 1. First, cluster1 runs its steps until they all complete and the cluster terminates.
> > 2. Then, cluster2a and cluster2b run their steps in parallel until they both terminate.
> > 3. Finally, cluster3 runs its steps.
> > 
> > Just to be clear, a "batch" of clusters is just a set of clusters that
> > can be run in EMR in parallel.
> > 
> > ## Why use this:
> > 1. The primary appeal of this operator is for submitting one-off tasks
> > to EMR. The most straight-forward way to do this is to set up a DAG
> > consisting of a single `EmrRunJobFlows` operator which derives its
> > `job_flows` value from the DagRun's conf attribute (
> > [`airflow dags trigger --conf`](https://airflow.readthedocs.io/en/latest/cli-ref.html#trigger)). While the actual EMR steps are
> > obfuscated, one small benefit from using this operator over modifying
> > the DAG using the existing EMR operators is that, while the resulting
> > work is dynamic at DagRun-time, the structure of the DAG stays constant
> > between wildly different runs, so we can see the execution history even
> > when a typical DAG would have been modified and lost its history in the
> > Web UI. A more complex implementation of this use-case in a closed-
> > source project was actually the motivation for this PR - my gratitude to
> > @ChengzhiZhao and @TarunChillara for their assistance there.
> > 
> > 1. It can also simplify the retry logic wherever
> > `EmrCreateJobFlowOperator` and `EmrJobFlowSensor` operator pairs are
> > used. In that scenario, the `retry_handler` of an `EmrJobFlowSensor`
> > task would need to run an `airflow clear` on the preceding
> > `EmrCreateJobFlowOperator` task if it detects that the cluster failed,
> > while somehow maintaining the total count of attempts. Using the
> > `EmrJobFlowSensor`, a cluster can be restarted on failure without a
> > custom `retry_handler` - simply by setting `retries > 0`. Please note
> > that, as described in its docstring, the current implementation of
> > `EmrRunJobFlows` limits the retry logic to just this basic use case.
> > This is because we don't expose any information for a `retry_handler` to
> > reason about at this time. This could be improved by pushing step- and
> > cluster- level status information to an XCom, but that is not
> > implemented here at this time because the operator implementation is
> > complex enough as is. If they are to be retried, please make sure that
> > all steps be idempotent.
> > 
> > ### Tests
> > * [x] My PR adds the following unit tests ~**OR** does not need testing for this extremely good reason~:
> > 
> > tests/contrib/sensors/test_emr_run_job_flows.py:
> > 
> > * [test_execute_calls_until_all_clusters_reach_a_terminal_state](https://github.com/apache/airflow/pull/6281/files#diff-19560b77d8ed6911d9103c04c0d67da7R85)
> > * [test_execute_stops_when_cluster_in_batch_fails](https://github.com/apache/airflow/pull/6281/files#diff-19560b77d8ed6911d9103c04c0d67da7R125)
> > * [test_execute_stops_on_cluster_creation_failure](https://github.com/apache/airflow/pull/6281/files#diff-19560b77d8ed6911d9103c04c0d67da7R156)
> > 
> > ### Commits
> > * [x] My commits all reference Jira issues in their subject lines, and I have squashed multiple commits if they address the same issue. In addition, my commits follow the guidelines from "[How to write a good git commit message](http://chris.beams.io/posts/git-commit/)":
> > 
> > 1. Subject is separated from body by a blank line
> > 2. Subject is limited to 50 characters (not including Jira issue reference)
> > 3. Subject does not end with a period
> > 4. Subject uses the imperative mood ("add", not "adding")
> > 5. Body wraps at 72 characters
> > 6. Body explains "what" and "why", not "how"
> > 
> > ### Documentation
> > * [x] In case of new functionality, my PR adds documentation that describes how to use it.
> > 
> > * All the public functions and the classes in the PR contain docstrings that explain what it does
> > * If you implement backwards incompatible changes, please leave a note in the [Updating.md](https://github.com/apache/airflow/blob/master/UPDATING.md) so we can assign it to a appropriate release
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)