dstandish commented on a change in pull request #19665:
URL: https://github.com/apache/airflow/pull/19665#discussion_r759689379
##########
File path: airflow/providers/amazon/aws/hooks/redshift.py
##########
@@ -65,9 +81,9 @@ def cluster_status(self, cluster_identifier: str) -> str:
"""
try:
response =
self.get_conn().describe_clusters(ClusterIdentifier=cluster_identifier)['Clusters']
- return response[0]['ClusterStatus'] if response else None
+ return RedshiftClusterStates(response[0]['ClusterStatus']) if
response else None
Review comment:
i read the comment and yeah in the 'not found' case that is the focus of
the example, sure returning an enum would be fine -- it's completely in your
control and a "made-up" status --- but forcing the raw api response into enum
is what i feel more iffy about.
and i'd easily say keep the enum there and use it when evaluating the
response (e.g. is it paused or available -- use the enum rather than hardcode).
just am unsure about converting the raw response in the return value and asking
for second opinion :)
--
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]