This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch airflow-ctl/v0-1-test
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/airflow-ctl/v0-1-test by this
push:
new 79141bf2440 [airflow-ctl/v0-1-test] Drop the redundant re-validation
round trip in airflowctl list pagination (#71928) (#72760)
79141bf2440 is described below
commit 79141bf24404ef9617f97ae192a644531677e3d9
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Wed Sep 9 12:50:47 2026 +0200
[airflow-ctl/v0-1-test] Drop the redundant re-validation round trip in
airflowctl list pagination (#71928) (#72760)
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.
(cherry picked from commit f1f7b8c2ccea97bc7d68c9300d0546c29fa75722)
Co-authored-by: Jyun-An Chen <[email protected]>
---
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 8a1e1f3b263..67d4c79adc1 100644
--- a/airflow-ctl/src/airflowctl/api/operations.py
+++ b/airflow-ctl/src/airflowctl/api/operations.py
@@ -235,8 +235,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