Uh oh!
There was an error while loading. Please reload this page.
Add support for deferrable operators in AMPP - #30032
Conversation
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
7717291 to
8c93e1aComparepotiuk
commented
Mar 27, 2023
You need to skip your aiobotocore tests conditionally - see other deferrable tests in aws |
b6b680d to
075f201CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
9633b59 to
f023f32Compare571789d to
b164050CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Add unit test for deferrable in test_redshift_cluster.py operator Add docstring for deferrable param
| with pytest.raises(TaskDeferred): | ||
| redshift_operator.execute(None) |
There was a problem hiding this comment.
Interesting. I was expecting to check that self.defer have been called, but this one works as well :)
vincbeck
commented
Apr 21, 2023
There are some static check failures |
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.
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.
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_connproperty inbase_aws.pywhich behaves similar to the existingconnproperty. 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 theconnproperty. Theget_client_typefunction is extended to handle returning aClientCreatorContextobject which can be used to get a client that supports asynchronous calls.Another addition this PR makes is extending
get_waiterinbase_aws.pyto work with custom async waiters. Currently, theget_waiterfunction allows us to create a custom waiter using a JSON config file. This PR allows passing aclientparameter which can be used to return an async waiter generated by theaiobotocorelibrary. 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
RedshiftCreateClusterOperatoris chosen to demonstrate how an operator would be modified to become a deferrable operator. We use the built-incluster_availablewaiter 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.rstor{issue_number}.significant.rst, in newsfragments.