uranusjr commented on a change in pull request #20226:
URL: https://github.com/apache/airflow/pull/20226#discussion_r767796609
##########
File path: airflow/providers/amazon/aws/hooks/base_aws.py
##########
@@ -128,18 +128,28 @@ def _create_session_with_assume_role(self,
session_kwargs: Dict[str, Any]) -> bo
)
session = botocore.session.get_session()
session._credentials = credentials
- region_name = self.basic_session.region_name
- session.set_config_variable("region", region_name)
+ if self.basic_session is not None:
+ region_name = self.basic_session.region_name
+ session.set_config_variable("region", region_name)
Review comment:
This suggests to me that `basic_session` _can’t_ actually be None
(otherwise current code would crash), so we should instead raise an exception
for that case.
##########
File path: airflow/providers/amazon/aws/hooks/base_aws.py
##########
@@ -128,18 +128,28 @@ def _create_session_with_assume_role(self,
session_kwargs: Dict[str, Any]) -> bo
)
session = botocore.session.get_session()
session._credentials = credentials
- region_name = self.basic_session.region_name
- session.set_config_variable("region", region_name)
+ if self.basic_session is not None:
+ region_name = self.basic_session.region_name
+ session.set_config_variable("region", region_name)
return boto3.session.Session(botocore_session=session,
**session_kwargs)
def _refresh_credentials(self) -> Dict[str, Any]:
self.log.info('Refreshing credentials')
assume_role_method = self.extra_config.get('assume_role_method',
'assume_role')
sts_session = self.basic_session
if assume_role_method == 'assume_role':
+ if sts_session is None:
+ raise Exception(
Review comment:
RuntimeError or AirflowException is better; a bare Exception is too
vague.
##########
File path: airflow/providers/google/cloud/hooks/automl.py
##########
@@ -17,27 +17,32 @@
# under the License.
#
"""This module contains a Google AutoML hook."""
-from typing import Dict, List, Optional, Sequence, Tuple, Union
+from typing import Dict, Optional, Sequence, Tuple, Union
+
+from google.cloud.automl_v1beta1.services.auto_ml.pagers import (
+ ListColumnSpecsPager,
+ ListDatasetsPager,
+ ListTableSpecsPager,
+)
Review comment:
I think isort should complain?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]