Prab-27 commented on code in PR #50132:
URL: https://github.com/apache/airflow/pull/50132#discussion_r2160097561
##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -148,6 +150,33 @@ def __init_subclass__(cls, **kwargs):
if callable(value):
setattr(cls, attr,
_check_flag_and_exit_if_server_response_error(value))
+ def return_all_entries(
+ self,
+ *,
+ path: str,
+ total_entries: int,
+ data_model: type[BaseModel],
+ entry_list: list,
+ offset: int = 0,
+ limit: int = 50,
+ params: dict | None = None,
+ **kwargs,
+ ) -> list | ServerResponseError:
+ if params is None:
+ params = {}
+ params.update({"limit": limit}, **kwargs)
+ try:
+ while offset < total_entries:
+ params.update({"offset": offset})
+ self.response = self.client.get(path, params=params)
+ entry = data_model.model_validate_json(self.response.content)
+ offset = offset + limit # default limit params = 50
+ entry_list.append(entry)
+
+ return entry_list
+ except ServerResponseError as e:
+ raise e
Review Comment:
Do I need to remove the try-except block from the `return_all_list` method,
since all list methods like `pools list` - already covered this exception?
--
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]