-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Grid view optimization #51805
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
Merged
Merged
Grid view optimization #51805
+2,231
−518
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
airflow-core/src/airflow/api_fastapi/core_api/datamodels/ui/common.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/routes/ui/grid.py
Outdated
Show resolved
Hide resolved
airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
Outdated
Show resolved
Hide resolved
airflow-core/tests/unit/api_fastapi/core_api/routes/ui/test_grid.py
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I love the general approach by splitting things into smaller request to not block UI rendering. Results are impressive!
It needs some polishing but I think we are going in the right direction.
That's a big effort, thanks Daniel for taking this one.
airflow-core/src/airflow/api_fastapi/core_api/services/ui/grid.py
Outdated
Show resolved
Hide resolved
3cf7428
to
a8106bd
Compare
bbovenzi
reviewed
Jun 17, 2025
375116d
to
337c898
Compare
The headline here is, with 3k tasks in a dag, loading time for 10 runs drops from 1.5m to < 10s in a quick local test. I split it into smaller more purpose-specific requests that each do less. So we have one request for just the structure, and another one for TI states (per dag run). I also find ways to stop refreshing when there's no active dag run (or the particuler dag run is not active and its tis don't need refreshing. I also changed the "latest dag run" query (which checks for a new run triggered externally to be simpler dedicated endpoint. It runs ever couple seconds even when there is nothing going on and now it takes 10ms instead of 300ms. In order to have the grid/structure request stop refreshing when nothing is active I had to add a new context provider so the state could be propagated from the grid/runs request (which knows if there's active runs). There may be a better way to do this, and the linter may not like it. Co-authored-by: Jed Cunningham <[email protected]>
This reverts commit e6f09a8.
83ff71a
to
2fddc03
Compare
ashb
approved these changes
Jun 25, 2025
#protm |
Nice one! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Work in progress branch for grid optimization
I break up the monolith that is grid_data.
The headline here is, with 6k tasks in a dag, loading time for 10 runs drops from 1.5m to < 10s in a quick local test.
I split it into smaller more purpose-specific requests that each do less. So we have one request for just the structure, and another one for TI states (per dag run). I also find ways to stop refreshing when there's no active dag run (or the particuler dag run is not active and its tis don't need refreshing. I also changed the "latest dag run" query (which checks for a new run triggered externally to be simpler dedicated endpoint. It runs ever couple seconds even when there is nothing going on and now it takes 10ms instead of 300ms.
In order to have the grid/structure request stop refreshing when nothing is active i had to add a new context provider so the state could be propagated from the grid/runs request (which knows if there's active runs). There may be a better way to do this, and the linter may not like it.
Here's an dag you can test this with. Before, if you had 10 runs, it would take 1.5 minutes to load. When I tried, it was 6 seconds. It's faster with non-dev mode than with dev mode presumably because of parallelism.
before (1.6m)
after (6s)
in action
refresh.of.big.dag.mov