pankajastro commented on code in PR #30244:
URL: https://github.com/apache/airflow/pull/30244#discussion_r1177690999


##########
airflow/providers/amazon/aws/operators/redshift_cluster.py:
##########
@@ -603,28 +605,62 @@ def __init__(
         self._attempts = 10
         self._attempt_interval = 15
         self.redshift_hook = RedshiftHook(aws_conn_id=aws_conn_id)
+        self.aws_conn_id = aws_conn_id
+        self.deferrable = deferrable
 
     def execute(self, context: Context):
-        while self._attempts >= 1:
-            try:
-                self.redshift_hook.delete_cluster(
+        if self.deferrable:
+            self.defer(
+                timeout=self.execution_timeout,
+                trigger=RedshiftClusterTrigger(
+                    task_id=self.task_id,
+                    poll_interval=self.poll_interval,
+                    aws_conn_id=self.aws_conn_id,
                     cluster_identifier=self.cluster_identifier,
+                    operation_type="delete_cluster",
                     
skip_final_cluster_snapshot=self.skip_final_cluster_snapshot,
                     
final_cluster_snapshot_identifier=self.final_cluster_snapshot_identifier,
-                )
-                break
-            except 
self.redshift_hook.get_conn().exceptions.InvalidClusterStateFault:
-                self._attempts = self._attempts - 1
+                    attempts=self._attempts,
+                ),
+                method_name="execute_complete",
+            )
+        else:
+            while self._attempts >= 1:

Review Comment:
   remove from this PR



-- 
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]

Reply via email to