Content-Length: 411137 | pFad | https://github.com/apache/airflow/commit/0a5e2281e084b228e697ffdd5d825b927fce9483

35 Remove some useless try/except from providers code (#33967) · apache/airflow@0a5e228 · GitHub
Skip to content

Commit 0a5e228

Browse files
Remove some useless try/except from providers code (#33967)
1 parent 17d031d commit 0a5e228

File tree

3 files changed

+18
-30
lines changed

3 files changed

+18
-30
lines changed

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

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
from typing import Any, Sequence
2222

2323
import botocore.exceptions
24-
from botocore.exceptions import ClientError
2524

2625
from airflow.exceptions import AirflowProviderDeprecationWarning
2726
from airflow.providers.amazon.aws.hooks.base_aws import AwsBaseAsyncHook, AwsBaseHook
@@ -70,17 +69,14 @@ def create_cluster(
7069
for the cluster that is being created.
7170
:param params: Remaining AWS Create cluster API params.
7271
"""
73-
try:
74-
response = self.get_conn().create_cluster(
75-
ClusterIdentifier=cluster_identifier,
76-
NodeType=node_type,
77-
MasterUsername=master_username,
78-
MasterUserPassword=master_user_password,
79-
**params,
80-
)
81-
return response
82-
except ClientError as e:
83-
raise e
72+
response = self.get_conn().create_cluster(
73+
ClusterIdentifier=cluster_identifier,
74+
NodeType=node_type,
75+
MasterUsername=master_username,
76+
MasterUserPassword=master_user_password,
77+
**params,
78+
)
79+
return response
8480

8581
# TODO: Wrap create_cluster_snapshot
8682
def cluster_status(self, cluster_identifier: str) -> str:

airflow/providers/dbt/cloud/hooks/dbt.py

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -254,15 +254,10 @@ async def get_job_status(
254254
:param include_related: Optional. List of related fields to pull with the run.
255255
Valid values are "trigger", "job", "repository", and "environment".
256256
"""
257-
try:
258-
self.log.info("Getting the status of job run %s.", run_id)
259-
response = await self.get_job_details(
260-
run_id, account_id=account_id, include_related=include_related
261-
)
262-
job_run_status: int = response["data"]["status"]
263-
return job_run_status
264-
except Exception as e:
265-
raise e
257+
self.log.info("Getting the status of job run %s.", run_id)
258+
response = await self.get_job_details(run_id, account_id=account_id, include_related=include_related)
259+
job_run_status: int = response["data"]["status"]
260+
return job_run_status
266261

267262
@cached_property
268263
def connection(self) -> Connection:

airflow/providers/google/cloud/hooks/cloud_sql.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -437,15 +437,12 @@ async def get_operation_name(self, project_id: str, operation_name: str, session
437437

438438
async def get_operation(self, project_id: str, operation_name: str):
439439
async with ClientSession() as session:
440-
try:
441-
operation = await self.get_operation_name(
442-
project_id=project_id,
443-
operation_name=operation_name,
444-
session=session,
445-
)
446-
operation = await operation.json(content_type=None)
447-
except HttpError as e:
448-
raise e
440+
operation = await self.get_operation_name(
441+
project_id=project_id,
442+
operation_name=operation_name,
443+
session=session,
444+
)
445+
operation = await operation.json(content_type=None)
449446
return operation
450447

451448

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/0a5e2281e084b228e697ffdd5d825b927fce9483

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy