You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2022/09/05 21:55:21 UTC
[GitHub] [airflow] kazanzhy commented on a diff in pull request #26003: Add RdsDbSensor to amazon provider package
kazanzhy commented on code in PR #26003:
URL: https://github.com/apache/airflow/pull/26003#discussion_r963135500
##########
airflow/providers/amazon/aws/sensors/rds.py:
##########
@@ -38,10 +38,10 @@ def __init__(self, *args, aws_conn_id: str = "aws_conn_id", hook_params: Optiona
hook_params = hook_params or {}
self.hook = RdsHook(aws_conn_id=aws_conn_id, **hook_params)
self.target_statuses: List[str] = []
+ self.check_status_field = "Status"
Review Comment:
I think it is OK to add one more `if-else`.
Actually, I meant something like:
```
def _check_item(self, item_type: str, item_name: str) -> bool:
"""Get certain item from `_describe_item()` and check its status"""
if item_type == 'db_instance':
status_field = 'DBInstanceStatus'
else:
status_field = 'Status'
try:
items = self._describe_item(item_type, item_name)
except ClientError:
return False
else:
return bool(items) and any(
map(lambda status: items[0][status_field].lower() == status, self.target_statuses)
)
```
WDYT?
--
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-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org