henry3260 commented on code in PR #68616:
URL: https://github.com/apache/airflow/pull/68616#discussion_r3529499965


##########
airflow-ctl/src/airflowctl/api/operations.py:
##########
@@ -688,6 +693,22 @@ def list(
             params["hostname"] = hostname
         if is_alive is not None:
             params["is_alive"] = is_alive
+        if dag_id:
+            params["dag_id"] = dag_id
+        if state:
+            params["job_state"] = state
+        if order_by:
+            params["order_by"] = order_by
+        elif limit is not None:
+            params["order_by"] = "-start_date"
+        if limit is not None:
+            params["limit"] = limit
+        if offset is not None:
+            params["offset"] = offset
+
+        if limit is not None or offset is not None:
+            self.response = self.client.get("jobs", params=params)
+            return 
JobCollectionResponse.model_validate_json(self.response.content)

Review Comment:
   > Could we use `execute_list()` ?
   
   I don’t think we can use `execute_list()` when `limit` or `offset` is 
explicitly provided.
   
   `execute_list()` is an auto-pagination helper: it treats `limit` as the page 
size, keeps requesting pages while `offset < total_entries`, and then merges 
all pages into one collection.
   



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