-
Notifications
You must be signed in to change notification settings - Fork 14.5k
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
Use base classes for AWS Lambda Operators/Sensors #34890
Merged
Merged
Changes from all commits
Commits
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 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
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
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
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
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
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
68 changes: 68 additions & 0 deletions
68
docs/apache-airflow-providers-amazon/_partials/generic_parameters.rst
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
.. Licensed to the Apache Software Foundation (ASF) under one | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice addition |
||
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. | ||
|
||
|
||
aws_conn_id | ||
Reference to :ref:`Amazon Web Services Connection <howto/connection:aws>` ID. | ||
If this parameter is set to ``None`` then the default boto3 behaviour is used without a connection lookup. | ||
Otherwise use the credentials stored in the Connection. Default: ``aws_default`` | ||
|
||
region_name | ||
AWS Region Name. If this parameter is set to ``None`` or omitted then **region_name** from | ||
:ref:`AWS Connection Extra Parameter <howto/connection:aws:configuring-the-connection>` will be used. | ||
Otherwise use the specified value instead of the connection value. Default: ``None`` | ||
|
||
verify | ||
Whether or not to verify SSL certificates. | ||
|
||
* ``False`` - Do not validate SSL certificates. | ||
* **path/to/cert/bundle.pem** - A filename of the CA cert bundle to use. You can specify this argument | ||
if you want to use a different CA cert bundle than the one used by botocore. | ||
|
||
If this parameter is set to ``None`` or is omitted then **verify** from | ||
:ref:`AWS Connection Extra Parameter <howto/connection:aws:configuring-the-connection>` will be used. | ||
Otherwise use the specified value instead of the connection value. Default: ``None`` | ||
|
||
botocore_config | ||
The provided dictionary is used to construct a `botocore.config.Config`_. | ||
This configuration can be used to configure :ref:`howto/connection:aws:avoid-throttling-exceptions`, timeouts, etc. | ||
|
||
.. code-block:: python | ||
:caption: Example, for more detail about parameters please have a look `botocore.config.Config`_ | ||
|
||
{ | ||
"signature_version": "unsigned", | ||
"s3": { | ||
"us_east_1_regional_endpoint": True, | ||
}, | ||
"retries": { | ||
"mode": "standard", | ||
"max_attempts": 10, | ||
}, | ||
"connect_timeout": 300, | ||
"read_timeout": 300, | ||
"tcp_keepalive": True, | ||
} | ||
|
||
If this parameter is set to ``None`` or omitted then **config_kwargs** from | ||
:ref:`AWS Connection Extra Parameter <howto/connection:aws:configuring-the-connection>` will be used. | ||
Otherwise use the specified value instead of the connection value. Default: ``None`` | ||
|
||
.. note:: | ||
Specifying an empty dictionary, ``{}``, will overwrite the connection configuration for `botocore.config.Config`_ | ||
|
||
.. _botocore.config.Config: https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html |
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
Oops, something went wrong.
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.
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.
I'll admit this format for the inheritence is new to me and I am trying to read up on how it's doing what it does, but it appears that the value inside the square brackets here is always the same as the value being assigned to
aws_hook_class
within the Operator. I don't suppose there is a way to simplify that so you don't need both?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.
In square brakets it is just typing.Generic, which help type annotate type of the
hook
property, all chain isairflow/airflow/providers/amazon/aws/utils/mixins.py
Line 39 in e9987d5
airflow/airflow/providers/amazon/aws/utils/mixins.py
Lines 100 to 102 in e9987d5
airflow/airflow/providers/amazon/aws/utils/mixins.py
Lines 111 to 112 in e9987d5
airflow/airflow/providers/amazon/aws/utils/mixins.py
Lines 148 to 151 in e9987d5
In general
class LambdaInvokeFunctionOperator(AwsBaseOperator[LambdaHook]):
for help IDE, static checkers to understand thathook
will returnLambdaHook
object (in our case we use only in one place), and in additional validate thataws_hook_class
should be a subclass ofLambdaHook
However information about generics doesn't available in runtime and we can't extract it from class definition, so we should assign actual class to
aws_hook_class
for construct hook inhook
property