syedahsn commented on code in PR #32437: URL: https://github.com/apache/airflow/pull/32437#discussion_r1263953725
########## airflow/providers/amazon/aws/operators/rds.py: ########## @@ -734,36 +733,72 @@ def __init__( *, db_identifier: str, db_type: RdsDbType | str = RdsDbType.INSTANCE, - aws_conn_id: str = "aws_default", wait_for_completion: bool = True, + waiter_delay: int = 30, + waiter_max_attempts: int = 40, + deferrable: bool = conf.getboolean("operators", "default_deferrable", fallback=False), **kwargs, ): - super().__init__(aws_conn_id=aws_conn_id, **kwargs) + super().__init__(**kwargs) self.db_identifier = db_identifier self.db_type = db_type self.wait_for_completion = wait_for_completion + self.waiter_delay = waiter_delay + self.waiter_max_attempts = waiter_max_attempts + self.deferrable = deferrable def execute(self, context: Context) -> str: self.db_type = RdsDbType(self.db_type) - start_db_response = self._start_db() - if self.wait_for_completion: + start_db_response: dict[str, Any] = self._start_db() + if self.deferrable: + self.defer( + trigger=RdsDbAvailableTrigger( + db_identifier=self.db_identifier, + waiter_delay=self.waiter_delay, + waiter_max_attempts=self.waiter_max_attempts, + aws_conn_id=self.aws_conn_id, + region_name=self.region_name, + response=start_db_response, + db_type=RdsDbType.INSTANCE, + ), + method_name="execute_complete", + ) + elif self.wait_for_completion: self._wait_until_db_available() return json.dumps(start_db_response, default=str) + def execute_complete(self, context, event=None) -> str: Review Comment: Forgot to add one more thing, can you update this to match the [new deferrable documentation](https://github.com/apache/airflow/blob/main/docs/apache-airflow/authoring-and-scheduling/deferring.rst?plain=1#L131) -- 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: commits-unsubscr...@airflow.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org