hankehly commented on code in PR #27410:
URL: https://github.com/apache/airflow/pull/27410#discussion_r1009652079


##########
airflow/providers/amazon/aws/hooks/rds.py:
##########
@@ -48,3 +50,291 @@ class RdsHook(AwsGenericHook["RDSClient"]):
     def __init__(self, *args, **kwargs) -> None:
         kwargs["client_type"] = "rds"
         super().__init__(*args, **kwargs)
+
+    def get_db_snapshot_state(self, snapshot_id: str) -> str:

Review Comment:
   For each of the following resources, I added:
   1. A method to get the resource state
   2. A method to wait for the resource to reach a certain state
   
   Resources:
   - db instance
   - db cluster
   - db snapshot
   - db cluster snapshot
   - export task
   - event subscription
   
   In the current implementation, `RdsBaseOperator` and `RdsBaseSensor` each 
have a method that calls the appropriate boto "describe" function based on a 
string (like "db_snapshot" or "event_subscription").
   
   
https://github.com/apache/airflow/blob/64174ce25ae800a38e712aa0bd62a5893ea2ff99/airflow/providers/amazon/aws/operators/rds.py#L49-L66
   
   I considered just moving this logic over to `RdsHook`, but decided to split 
it up because the existence (and variety) of boto waiters depends on the 
resource. For example, the db snapshot resource has 3 boto waiters, the db 
cluster snapshot resource has 2, and the export task resource has none.
   
   One could maybe reduce the amount of code by keep a separate list of 
resources and their waiters and dynamically choosing at runtime, but I didn't 
go that far.



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