ashb commented on a change in pull request #20353:
URL: https://github.com/apache/airflow/pull/20353#discussion_r770948413
##########
File path: airflow/providers/amazon/aws/hooks/eks.py
##########
@@ -349,7 +349,7 @@ def describe_fargate_profile(
)
return response
- def get_cluster_state(self, clusterName: str) -> ClusterStates:
+ def get_cluster_state(self, clusterName: str) -> Optional[ClusterStates]:
Review comment:
This function shouldn't be optional -- it always returns something.
##########
File path: airflow/providers/amazon/aws/hooks/eks.py
##########
@@ -360,14 +360,19 @@ def get_cluster_state(self, clusterName: str) ->
ClusterStates:
:rtype: ClusterStates
"""
eks_client = self.conn
+ result = None
try:
- return
ClusterStates(eks_client.describe_cluster(name=clusterName).get('cluster').get('status'))
+ result =
ClusterStates(eks_client.describe_cluster(name=clusterName).get('cluster').get('status'))
Review comment:
This seems like a change for change's sake -- the previous version
should have been okay, so lets stick with that please.
##########
File path: airflow/providers/amazon/aws/hooks/eks.py
##########
@@ -360,14 +360,19 @@ def get_cluster_state(self, clusterName: str) ->
ClusterStates:
:rtype: ClusterStates
"""
eks_client = self.conn
+ result = None
try:
- return
ClusterStates(eks_client.describe_cluster(name=clusterName).get('cluster').get('status'))
+ result =
ClusterStates(eks_client.describe_cluster(name=clusterName).get('cluster').get('status'))
except ClientError as ex:
if ex.response.get("Error").get("Code") ==
"ResourceNotFoundException":
- return ClusterStates.NONEXISTENT
+ result = ClusterStates.NONEXISTENT
- def get_fargate_profile_state(self, clusterName: str, fargateProfileName:
str) -> FargateProfileStates:
+ return result
+
+ def get_fargate_profile_state(
+ self, clusterName: str, fargateProfileName: str
+ ) -> Optional[FargateProfileStates]:
Review comment:
Again, not optional -- always has a return.
--
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]