Content-Length: 937423 | pFad | https://github.com/apache/airflow/commit/2bc103698fad1b7c0bebed0d5cbdda0ec7ea83c3

EB Unify `aws_conn_id` type to always be `str | None` (#37768) · apache/airflow@2bc1036 · GitHub
Skip to content

Commit 2bc1036

Browse files
author
Emil Ejbyfeldt
authored
Unify aws_conn_id type to always be str | None (#37768)
1 parent fb65112 commit 2bc1036

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+305
-171
lines changed

airflow/providers/amazon/aws/hooks/redshift_sql.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class RedshiftSQLHook(DbApiHook):
5959
hook_name = "Amazon Redshift"
6060
supports_autocommit = True
6161

62-
def __init__(self, *args, aws_conn_id: str = "aws_default", **kwargs) -> None:
62+
def __init__(self, *args, aws_conn_id: str | None = "aws_default", **kwargs) -> None:
6363
super().__init__(*args, **kwargs)
6464
self.aws_conn_id = aws_conn_id
6565

airflow/providers/amazon/aws/operators/appflow.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,11 @@ class AppflowRunOperator(AppflowBaseOperator):
143143
:param source: Obsolete, unnecessary for this operator
144144
:param flow_name: The flow name
145145
:param poll_interval: how often in seconds to check the query status
146-
:param aws_conn_id: aws connection to use
146+
:param aws_conn_id: The Airflow connection used for AWS credentials.
147+
If this is None or empty then the default boto3 behaviour is used. If
148+
running Airflow in a distributed manner and aws_conn_id is None or
149+
empty, then default boto3 configuration would be used (and must be
150+
maintained on each worker node).
147151
:param region: aws region to use
148152
:param wait_for_completion: whether to wait for the run to end to return
149153
"""
@@ -222,7 +226,11 @@ class AppflowRunBeforeOperator(AppflowBaseOperator):
222226
:param source_field: The field name to apply filters
223227
:param filter_date: The date value (or template) to be used in filters.
224228
:param poll_interval: how often in seconds to check the query status
225-
:param aws_conn_id: aws connection to use
229+
:param aws_conn_id: The Airflow connection used for AWS credentials.
230+
If this is None or empty then the default boto3 behaviour is used. If
231+
running Airflow in a distributed manner and aws_conn_id is None or
232+
empty, then default boto3 configuration would be used (and must be
233+
maintained on each worker node).
226234
:param region: aws region to use
227235
:param wait_for_completion: whether to wait for the run to end to return
228236
"""

airflow/providers/amazon/aws/operators/cloud_formation.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def __init__(
9696
*,
9797
stack_name: str,
9898
cloudformation_parameters: dict | None = None,
99-
aws_conn_id: str = "aws_default",
99+
aws_conn_id: str | None = "aws_default",
100100
**kwargs,
101101
):
102102
super().__init__(**kwargs)

airflow/providers/amazon/aws/operators/dms.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def __init__(
7979
table_mappings: dict,
8080
migration_type: str = "full-load",
8181
create_task_kwargs: dict | None = None,
82-
aws_conn_id: str = "aws_default",
82+
aws_conn_id: str | None = "aws_default",
8383
**kwargs,
8484
):
8585
super().__init__(**kwargs)
@@ -226,7 +226,7 @@ def __init__(
226226
replication_task_arn: str,
227227
start_replication_task_type: str = "start-replication",
228228
start_task_kwargs: dict | None = None,
229-
aws_conn_id: str = "aws_default",
229+
aws_conn_id: str | None = "aws_default",
230230
**kwargs,
231231
):
232232
super().__init__(**kwargs)

airflow/providers/amazon/aws/operators/ec2.py

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ class EC2StartInstanceOperator(BaseOperator):
3636
:ref:`howto/operator:EC2StartInstanceOperator`
3737
3838
:param instance_id: id of the AWS EC2 instance
39-
:param aws_conn_id: aws connection to use
39+
:param aws_conn_id: The Airflow connection used for AWS credentials.
40+
If this is None or empty then the default boto3 behaviour is used. If
41+
running Airflow in a distributed manner and aws_conn_id is None or
42+
empty, then default boto3 configuration would be used (and must be
43+
maintained on each worker node).
4044
:param region_name: (optional) aws region name associated with the client
4145
:param check_interval: time in seconds that the job should wait in
4246
between each instance state checks until operation is completed
@@ -50,7 +54,7 @@ def __init__(
5054
self,
5155
*,
5256
instance_id: str,
53-
aws_conn_id: str = "aws_default",
57+
aws_conn_id: str | None = "aws_default",
5458
region_name: str | None = None,
5559
check_interval: float = 15,
5660
**kwargs,
@@ -82,7 +86,11 @@ class EC2StopInstanceOperator(BaseOperator):
8286
:ref:`howto/operator:EC2StopInstanceOperator`
8387
8488
:param instance_id: id of the AWS EC2 instance
85-
:param aws_conn_id: aws connection to use
89+
:param aws_conn_id: The Airflow connection used for AWS credentials.
90+
If this is None or empty then the default boto3 behaviour is used. If
91+
running Airflow in a distributed manner and aws_conn_id is None or
92+
empty, then default boto3 configuration would be used (and must be
93+
maintained on each worker node).
8694
:param region_name: (optional) aws region name associated with the client
8795
:param check_interval: time in seconds that the job should wait in
8896
between each instance state checks until operation is completed
@@ -96,7 +104,7 @@ def __init__(
96104
self,
97105
*,
98106
instance_id: str,
99-
aws_conn_id: str = "aws_default",
107+
aws_conn_id: str | None = "aws_default",
100108
region_name: str | None = None,
101109
check_interval: float = 15,
102110
**kwargs,
@@ -130,7 +138,11 @@ class EC2CreateInstanceOperator(BaseOperator):
130138
:param image_id: ID of the AMI used to create the instance.
131139
:param max_count: Maximum number of instances to launch. Defaults to 1.
132140
:param min_count: Minimum number of instances to launch. Defaults to 1.
133-
:param aws_conn_id: AWS connection to use
141+
:param aws_conn_id: The Airflow connection used for AWS credentials.
142+
If this is None or empty then the default boto3 behaviour is used. If
143+
running Airflow in a distributed manner and aws_conn_id is None or
144+
empty, then default boto3 configuration would be used (and must be
145+
maintained on each worker node).
134146
:param region_name: AWS region name associated with the client.
135147
:param poll_interval: Number of seconds to wait before attempting to
136148
check state of instance. Only used if wait_for_completion is True. Default is 20.
@@ -156,7 +168,7 @@ def __init__(
156168
image_id: str,
157169
max_count: int = 1,
158170
min_count: int = 1,
159-
aws_conn_id: str = "aws_default",
171+
aws_conn_id: str | None = "aws_default",
160172
region_name: str | None = None,
161173
poll_interval: int = 20,
162174
max_attempts: int = 20,
@@ -223,7 +235,11 @@ class EC2TerminateInstanceOperator(BaseOperator):
223235
:ref:`howto/operator:EC2TerminateInstanceOperator`
224236
225237
:param instance_id: ID of the instance to be terminated.
226-
:param aws_conn_id: AWS connection to use
238+
:param aws_conn_id: The Airflow connection used for AWS credentials.
239+
If this is None or empty then the default boto3 behaviour is used. If
240+
running Airflow in a distributed manner and aws_conn_id is None or
241+
empty, then default boto3 configuration would be used (and must be
242+
maintained on each worker node).
227243
:param region_name: AWS region name associated with the client.
228244
:param poll_interval: Number of seconds to wait before attempting to
229245
check state of instance. Only used if wait_for_completion is True. Default is 20.
@@ -238,7 +254,7 @@ class EC2TerminateInstanceOperator(BaseOperator):
238254
def __init__(
239255
self,
240256
instance_ids: str | list[str],
241-
aws_conn_id: str = "aws_default",
257+
aws_conn_id: str | None = "aws_default",
242258
region_name: str | None = None,
243259
poll_interval: int = 20,
244260
max_attempts: int = 20,
@@ -280,7 +296,11 @@ class EC2RebootInstanceOperator(BaseOperator):
280296
:ref:`howto/operator:EC2RebootInstanceOperator`
281297
282298
:param instance_ids: ID of the instance(s) to be rebooted.
283-
:param aws_conn_id: AWS connection to use
299+
:param aws_conn_id: The Airflow connection used for AWS credentials.
300+
If this is None or empty then the default boto3 behaviour is used. If
301+
running Airflow in a distributed manner and aws_conn_id is None or
302+
empty, then default boto3 configuration would be used (and must be
303+
maintained on each worker node).
284304
:param region_name: AWS region name associated with the client.
285305
:param poll_interval: Number of seconds to wait before attempting to
286306
check state of instance. Only used if wait_for_completion is True. Default is 20.
@@ -298,7 +318,7 @@ def __init__(
298318
self,
299319
*,
300320
instance_ids: str | list[str],
301-
aws_conn_id: str = "aws_default",
321+
aws_conn_id: str | None = "aws_default",
302322
region_name: str | None = None,
303323
poll_interval: int = 20,
304324
max_attempts: int = 20,
@@ -339,7 +359,11 @@ class EC2HibernateInstanceOperator(BaseOperator):
339359
:ref:`howto/operator:EC2HibernateInstanceOperator`
340360
341361
:param instance_ids: ID of the instance(s) to be hibernated.
342-
:param aws_conn_id: AWS connection to use
362+
:param aws_conn_id: The Airflow connection used for AWS credentials.
363+
If this is None or empty then the default boto3 behaviour is used. If
364+
running Airflow in a distributed manner and aws_conn_id is None or
365+
empty, then default boto3 configuration would be used (and must be
366+
maintained on each worker node).
343367
:param region_name: AWS region name associated with the client.
344368
:param poll_interval: Number of seconds to wait before attempting to
345369
check state of instance. Only used if wait_for_completion is True. Default is 20.
@@ -357,7 +381,7 @@ def __init__(
357381
self,
358382
*,
359383
instance_ids: str | list[str],
360-
aws_conn_id: str = "aws_default",
384+
aws_conn_id: str | None = "aws_default",
361385
region_name: str | None = None,
362386
poll_interval: int = 20,
363387
max_attempts: int = 20,

airflow/providers/amazon/aws/operators/eks.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
def _create_compute(
7474
compute: str | None,
7575
cluster_name: str,
76-
aws_conn_id: str,
76+
aws_conn_id: str | None,
7777
region: str | None,
7878
waiter_delay: int,
7979
waiter_max_attempts: int,
@@ -231,7 +231,7 @@ def __init__(
231231
fargate_selectors: list | None = None,
232232
create_fargate_profile_kwargs: dict | None = None,
233233
wait_for_completion: bool = False,
234-
aws_conn_id: str = DEFAULT_CONN_ID,
234+
aws_conn_id: str | None = DEFAULT_CONN_ID,
235235
region: str | None = None,
236236
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
237237
waiter_delay: int = 30,
@@ -483,7 +483,7 @@ def __init__(
483483
nodegroup_name: str = DEFAULT_NODEGROUP_NAME,
484484
create_nodegroup_kwargs: dict | None = None,
485485
wait_for_completion: bool = False,
486-
aws_conn_id: str = DEFAULT_CONN_ID,
486+
aws_conn_id: str | None = DEFAULT_CONN_ID,
487487
region: str | None = None,
488488
waiter_delay: int = 30,
489489
waiter_max_attempts: int = 80,
@@ -608,7 +608,7 @@ def __init__(
608608
fargate_profile_name: str = DEFAULT_FARGATE_PROFILE_NAME,
609609
create_fargate_profile_kwargs: dict | None = None,
610610
wait_for_completion: bool = False,
611-
aws_conn_id: str = DEFAULT_CONN_ID,
611+
aws_conn_id: str | None = DEFAULT_CONN_ID,
612612
region: str | None = None,
613613
waiter_delay: int = 10,
614614
waiter_max_attempts: int = 60,
@@ -712,7 +712,7 @@ def __init__(
712712
cluster_name: str,
713713
force_delete_compute: bool = False,
714714
wait_for_completion: bool = False,
715-
aws_conn_id: str = DEFAULT_CONN_ID,
715+
aws_conn_id: str | None = DEFAULT_CONN_ID,
716716
region: str | None = None,
717717
deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False),
718718
waiter_delay: int = 30,
@@ -843,7 +843,7 @@ def __init__(
843843
cluster_name: str,
844844
nodegroup_name: str,
845845
wait_for_completion: bool = False,
846-
aws_conn_id: str = DEFAULT_CONN_ID,
846+
aws_conn_id: str | None = DEFAULT_CONN_ID,
847847
region: str | None = None,
848848
waiter_delay: int = 30,
849849
waiter_max_attempts: int = 40,
@@ -933,7 +933,7 @@ def __init__(
933933
cluster_name: str,
934934
fargate_profile_name: str,
935935
wait_for_completion: bool = False,
936-
aws_conn_id: str = DEFAULT_CONN_ID,
936+
aws_conn_id: str | None = DEFAULT_CONN_ID,
937937
region: str | None = None,
938938
waiter_delay: int = 30,
939939
waiter_max_attempts: int = 60,
@@ -1045,7 +1045,7 @@ def __init__(
10451045
pod_context: str | None = None,
10461046
pod_name: str | None = None,
10471047
pod_username: str | None = None,
1048-
aws_conn_id: str = DEFAULT_CONN_ID,
1048+
aws_conn_id: str | None = DEFAULT_CONN_ID,
10491049
region: str | None = None,
10501050
on_finish_action: str | None = None,
10511051
is_delete_operator_pod: bool | None = None,

0 commit comments

Comments
 (0)








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: https://github.com/apache/airflow/commit/2bc103698fad1b7c0bebed0d5cbdda0ec7ea83c3

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy