This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new f1f7b8c2cce Drop the redundant re-validation round trip in airflowctl
list pagination (#71928)
f1f7b8c2cce is described below
commit f1f7b8c2ccea97bc7d68c9300d0546c29fa75722
Author: Jyun-An Chen <[email protected]>
AuthorDate: Wed Sep 9 09:33:15 2026 +0800
Drop the redundant re-validation round trip in airflowctl list pagination
(#71928)
BaseOperations.execute_list built the merged multi-page result, then
serialized it back to a dict with model_dump() and re-validated it as
the same model with model_validate() before returning it. The object
was already fully validated the moment it was constructed -- Pydantic
validates on __init__, and every entry in the merged list had already
gone through safe_validate() while parsing its page -- so the extra
round trip re-checked data that was already known to be valid.
Benchmarked with 20,000 entries
(dev/benchmark_ctl_execute_list_roundtrip.py):
the redundant dump+validate cost ~520ms and ~94 MiB of peak memory on
top of an otherwise instant return.
---
airflow-ctl/src/airflowctl/api/operations.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/airflow-ctl/src/airflowctl/api/operations.py
b/airflow-ctl/src/airflowctl/api/operations.py
index 7c10eebedf0..a800fa5390c 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -240,8 +240,7 @@ class BaseOperations:
entry = safe_validate(self.response.content)
offset = offset + limit
entry_list.extend(getattr(entry, found_key))
- obj = data_model(**{found_key: entry_list, "total_entries":
total_entries})
- return data_model.model_validate(obj.model_dump()) # type:
ignore[union-attr]
+ return data_model(**{found_key: entry_list, "total_entries":
total_entries})
# Login operations