-
Notifications
You must be signed in to change notification settings - Fork 14.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AIP-84 Limit and filters not applied correctly for dag runs API. #46572
Comments
From your initial PR conversation, I understood you are referencing the part where you extract If so I believe that this number is not affected by pagination limits and offsets, the dag_run_select, total_entries = paginated_select(
statement=query,
filters=[logical_date, start_date_range, end_date_range, update_at_range, state],
order_by=order_by,
offset=offset,
limit=limit,
session=session,
) And with curl it works as you mention: curl run for 2 entriescurl -X 'GET' \
'http://localhost:29091/public/dags/example_bash_decorator/dagRuns?limit=2&order_by=-start_date' \
-H 'accept: application/json' | jq
{
"dag_runs": [
{
"dag_run_id": "manual__2025-02-08T23:20:51.665298+00:00",
"dag_id": "example_bash_decorator",
"logical_date": "2025-02-08T23:20:51.673703Z",
"queued_at": "2025-02-08T23:20:51.688648Z",
"start_date": "2025-02-08T23:38:06.692506Z",
"end_date": "2025-02-08T23:38:09.660110Z",
"data_interval_start": "2025-02-08T23:20:51.673703Z",
"data_interval_end": "2025-02-08T23:20:51.673703Z",
"last_scheduling_decision": "2025-02-08T23:38:09.656040Z",
"run_type": "manual",
"state": "failed",
"external_trigger": true,
"triggered_by": "rest_api",
"conf": {},
"note": null
},
{
"dag_run_id": "manual__2025-02-08T23:04:32.759689+00:00",
"dag_id": "example_bash_decorator",
"logical_date": "2025-02-08T23:04:32.759689Z",
"queued_at": "2025-02-08T23:04:32.784971Z",
"start_date": "2025-02-08T23:04:33.602888Z",
"end_date": "2025-02-08T23:04:36.819802Z",
"data_interval_start": "2025-02-08T23:04:32.759689Z",
"data_interval_end": "2025-02-08T23:04:32.759689Z",
"last_scheduling_decision": "2025-02-08T23:04:36.817639Z",
"run_type": "manual",
"state": "failed",
"external_trigger": true,
"triggered_by": "ui",
"conf": {},
"note": null
}
],
"total_entries": 127
} Or the problem is that API returns the wrong number of entries in |
I have identified the problem. I should be able to open a PR to fix that. |
Thanks @pierrejeambrun , from my understanding the QueryLimit and QueryOffset are module level variable initialised only once and using it on type annotations the same LimitFilter object gets used for requests. This is reproducible only in UI with parallel requests where the limit values of different APIs overwrite each other and the final value is taken into account. In curl since it's sequential the limit filter object is updated properly. This might be applicable to other filters as well constructed in similar manner. |
Sorry for my previous question, but the exact problem was initially unclear to me. Great to see that the root cause was identified already by Pierre! |
PR: #46619 |
Apache Airflow version
main (development)
If "Other Airflow 2 version" selected, which one?
No response
What happened?
It seems the
limit
filter is not honored in the dagruns api as below. Though limit 14 is applied all dagruns are returned. This is slightly tricky to reproduce since the limit is passed correctly to API and doesn't work through UI but curl works. Ref #46504 (comment)curl http://localhost:8000/public/dags/tutorial_taskflow_api/dagRuns\?limit\=14
What you think should happen instead?
No response
How to reproduce
Operating System
Ubuntu 20.04.3 LTS
Versions of Apache Airflow Providers
No response
Deployment
Virtualenv installation
Deployment details
No response
Anything else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: