airflow icon indicating copy to clipboard operation
airflow copied to clipboard

refactor: move task stream filtering logic to endpoint for Grid

Open OscarLigthart opened this issue 1 month ago • 1 comments

Following PR #57237, @bbovenzi gave me a piece of feedback that we should try to avoid fetching all of the tasks a second time and then iterating through them all again on the frontend. Instead, we should add the filter parameters to the existing grid structure endpoint. Keeping scopes of PRs small, I decided to do it in separate PR.

Enter this PR, which introduces exactly that. It simplifies the frontend Grid behaviour in favour of implementing the filter logic in the backend.


^ Add meaningful description above Read the Pull Request Guidelines for more information. In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed. In case of a new dependency, check compliance with the ASF 3rd Party License Policy. In case of backwards incompatible changes please leave a note in a newsfragment file, named {pr_number}.significant.rst or {issue_number}.significant.rst, in airflow-core/newsfragments.

OscarLigthart avatar Nov 22 '25 10:11 OscarLigthart

Do you mind updating the tests for the backend endpoint (structure), for these newly added query parameters? (with a few different combinations)

Great point 👍 Adding the test actually showed me that I forgot to account for the retrieval of historical tasks. To make the code a bit clearer, I moved that part to services.

I thought it would make sense to refrain from retrieving historical tasks in case of filtering the DAG. Let me know whether you agree or not!

OscarLigthart avatar Dec 03 '25 12:12 OscarLigthart

Thanks @OscarLigthart! 🎉

pierrejeambrun avatar Dec 18 '25 15:12 pierrejeambrun