ramitkataria commented on code in PR #68922:
URL: https://github.com/apache/airflow/pull/68922#discussion_r3471015977
##########
providers/amazon/src/airflow/providers/amazon/aws/operators/redshift_cluster.py:
##########
@@ -871,8 +874,52 @@ def __init__(
self._attempt_interval = 15
self.deferrable = deferrable
self.max_attempts = max_attempts
+ self.resume_if_paused = resume_if_paused
+
+ def _resume_if_paused(self) -> None:
+ """
+ Resume the cluster if it is paused.
+
+ A paused Redshift cluster cannot be deleted. If the cluster is
currently paused, resume it
+ and wait until it reaches the ``available`` state before continuing.
+ """
+ # Gated behind the opt-in ``resume_if_paused`` flag: resume and delete
are two separate,
+ # non-transactional AWS calls, so a failure between them would leave
the cluster running.
+ try:
+ cluster_state =
self.hook.cluster_status(cluster_identifier=self.cluster_identifier)
+ except self.hook.conn.exceptions.ClusterNotFoundFault:
Review Comment:
This try/catch appears to be redundant because `self.hook.cluster_status`
already catches that error
--
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]