-
Notifications
You must be signed in to change notification settings - Fork 14.4k
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
Add support for deferrable operators in AMPP #30032
Merged
potiuk
merged 25 commits into
apache:main
from
aws-mwaa:syedahsn/deferrable-redshift-create-cluster
Apr 24, 2023
Merged
Add support for deferrable operators in AMPP #30032
potiuk
merged 25 commits into
apache:main
from
aws-mwaa:syedahsn/deferrable-redshift-create-cluster
Apr 24, 2023
Conversation
This file contains 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
boring-cyborg
bot
added
area:providers
provider:amazon-aws
AWS/Amazon - related issues
labels
Mar 10, 2023
eladkal
reviewed
Mar 10, 2023
Taragolis
reviewed
Mar 11, 2023
syedahsn
force-pushed
the
syedahsn/deferrable-redshift-create-cluster
branch
5 times, most recently
from
March 25, 2023 00:02
7717291
to
8c93e1a
Compare
You need to skip your aiobotocore tests conditionally - see other deferrable tests in aws |
syedahsn
force-pushed
the
syedahsn/deferrable-redshift-create-cluster
branch
7 times, most recently
from
March 29, 2023 18:29
b6b680d
to
075f201
Compare
vandonr-amz
reviewed
Mar 29, 2023
Taragolis
reviewed
Mar 29, 2023
Taragolis
reviewed
Mar 29, 2023
syedahsn
force-pushed
the
syedahsn/deferrable-redshift-create-cluster
branch
4 times, most recently
from
April 6, 2023 17:07
9633b59
to
f023f32
Compare
syedahsn
force-pushed
the
syedahsn/deferrable-redshift-create-cluster
branch
2 times, most recently
from
April 11, 2023 16:52
571789d
to
b164050
Compare
vincbeck
requested changes
Apr 19, 2023
Add unit test for deferrable in test_redshift_cluster.py operator Add docstring for deferrable param
vincbeck
reviewed
Apr 21, 2023
Comment on lines
+132
to
+133
with pytest.raises(TaskDeferred): | ||
redshift_operator.execute(None) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting. I was expecting to check that self.defer
have been called, but this one works as well :)
vincbeck
approved these changes
Apr 21, 2023
There are some static check failures |
potiuk
approved these changes
Apr 24, 2023
17 tasks
potiuk
added a commit
to potiuk/airflow
that referenced
this pull request
Apr 26, 2023
The apache#30032 has been merged with aiobotore as required dependency. The aiobotocore package adds specific requirements for botocore and boto and it conflicts with older versions of Airflow, so we have to bring it back as optional dependency of the amazon provider.
potiuk
added a commit
that referenced
this pull request
Apr 26, 2023
The #30032 has been merged with aiobotore as required dependency. The aiobotocore package adds specific requirements for botocore and boto and it conflicts with older versions of Airflow, so we have to bring it back as optional dependency of the amazon provider.
19 tasks
This was referenced Apr 26, 2023
2 tasks
This was referenced Jun 27, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The purpose of this PR is to add the foundations required to convert AMPP operators to deferrable operators.
The aiobotocore library is being used to make all async calls to the boto3 API.
Rather than create separate Async hooks for every service, we create an
async_conn
property inbase_aws.py
which behaves similar to the existingconn
property. This property allows us to get access to a client that can make async boto3 API calls. This also allows us to make use of the supporting code that exists for theconn
property. Theget_client_type
function is extended to handle returning aClientCreatorContext
object which can be used to get a client that supports asynchronous calls.Another addition this PR makes is extending
get_waiter
inbase_aws.py
to work with custom async waiters. Currently, theget_waiter
function allows us to create a custom waiter using a JSON config file. This PR allows passing aclient
parameter which can be used to return an async waiter generated by theaiobotocore
library. This feature will save a lot of code duplication by standardizing the polling portion of Triggers. A README.md file is included that describes how Triggers can be written which make use of these features. Although not all operators and sensor will be able to make use of these features, there are many in the AMPP that can be written in a standardized format following the methods described.The
RedshiftCreateClusterOperator
is chosen to demonstrate how an operator would be modified to become a deferrable operator. We use the built-incluster_available
waiter in the Trigger to asynchronously poll the boto3 API to wait for the cluster to become available.@Taragolis, @uranusjr , @potiuk , @pankajastro I'd love to hear your thoughts on this approach, and see what you think.
^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an 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 a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.