hussein-awala commented on code in PR #30244:
URL: https://github.com/apache/airflow/pull/30244#discussion_r1210031369
##########
airflow/providers/amazon/aws/triggers/redshift_cluster.py:
##########
@@ -357,3 +357,78 @@ async def run(self):
)
else:
yield TriggerEvent({"status": "success", "message": "Cluster
resumed"})
+
+
+class RedshiftDeleteClusterTrigger(BaseTrigger):
+ """
+ Trigger for RedshiftDeleteClusterOperator
+
+ :param cluster_identifier: A unique identifier for the cluster.
+ :param max_attempts: The maximum number of attempts to be made.
+ :param aws_conn_id: The Airflow connection used for AWS credentials.
+ :param poll_interval: The amount of time in seconds to wait between
attempts.
+ """
+
+ def __init__(
+ self,
+ cluster_identifier: str,
+ max_attempts: int = 30,
+ aws_conn_id: str = "aws_default",
+ poll_interval: int = 30,
+ ):
+ super().__init__()
+ self.cluster_identifier = cluster_identifier
+ self.max_attempts = max_attempts
+ self.aws_conn_id = aws_conn_id
+ self.poll_interval = poll_interval
+
+ def serialize(self) -> tuple[str, dict[str, Any]]:
+ return (
+
"airflow.providers.amazon.aws.triggers.redshift_cluster.RedshiftDeleteClusterTrigger",
+ {
+ "cluster_identifier": self.cluster_identifier,
+ "max_attempts": self.max_attempts,
+ "aws_conn_id": self.aws_conn_id,
+ "poll_interval": self.poll_interval,
+ },
+ )
+
+ @cached_property
+ def hook(self):
+ return RedshiftHook(aws_conn_id=self.aws_conn_id)
Review Comment:
just out of curiosity, why are you using `RedshiftHook` instead of
`RedshiftAsyncHook`? (I see it used in 3 of the other 4 triggers)
##########
airflow/providers/amazon/aws/operators/redshift_cluster.py:
##########
@@ -629,6 +630,8 @@ class RedshiftDeleteClusterOperator(BaseOperator):
The default value is ``True``
:param aws_conn_id: aws connection to use
:param poll_interval: Time (in seconds) to wait between two consecutive
calls to check cluster state
+ :param deferrable: Run operator in the deferrable mode.
+ :param max_attempts: (Deferrable mode only) The maximum number of attempts
to be made
Review Comment:
I see it used in no deferrable mode too :thinking:
--
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]