Skip to content

Conversation

guan404ming
Copy link
Contributor

@guan404ming guan404ming commented May 18, 2025

Related Issue

#50333
cc @bbovenzi @pierrejeambrun

Why

The log rendering would be quite slow or even crash browser when rendering large logs on the frontend

How

By using @tanstack/react-virtual to support virtualized rendering, I mostly follow this official example to implement. I choose to use dynamic rendering instead of specifying fixed height since our log would have different height.

--> about 7x speed up (for 10000 logs on my local machine and tested 10 times)
Calculated from the moment the browser logs the parsed logs to the console until it’s finally rendered on the screen. Although this isn’t perfectly precise, it still gives a simple metric to confirm that our speed-up trend is positive.

before -> avg 7s

Screen.Recording.2025-05-18.at.3.38.53.PM.mov

after -> avg 1s

Screen.Recording.2025-05-18.at.3.37.58.PM.mov

Minor change: add accept field for useLog, which make us to support ndjson easily by changing the field value and adding parse func for it after it is fully supported in the future.


^ 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.

@boring-cyborg boring-cyborg bot added the area:UI Related to UI/UX. For Frontend Developers. label May 18, 2025
@guan404ming guan404ming marked this pull request as draft May 18, 2025 08:24
@jscheffl
Copy link
Contributor

Cool! I feel not confident to review but very great improvement!
Test needs to be fixed though.

@guan404ming
Copy link
Contributor Author

Thanks! I'm still trying to figure out how to test virtualized list.

@aritra24
Copy link
Collaborator

Nice change! Good job!

@guan404ming guan404ming marked this pull request as ready for review May 18, 2025 17:06
@guan404ming guan404ming force-pushed the refactor-ti-log branch 4 times, most recently from 3e1bc49 to 2a9eb7b Compare May 22, 2025 17:15
@bbovenzi bbovenzi added this to the Airflow 3.1.0 milestone May 22, 2025
@guan404ming
Copy link
Contributor Author

guan404ming commented May 25, 2025

Currently the list is worked in large monitor as in the small screen

Here are screenshots on 27 inch monitor
image
image

@bbovenzi
Copy link
Contributor

Looks good overall. Just one nit.

And then, I wonder if we want this in 3.0.2 instead of 3.1.0? Its an enhancement, not a new feature.

@guan404ming
Copy link
Contributor Author

guan404ming commented May 29, 2025

And then, I wonder if we want this in 3.0.2 instead of 3.1.0? Its an enhancement, not a new feature.

I think it should go into 3.0.2 since it doesn’t affect how users interact with the component. I’d consider it more of an enhancement for ux. Imo the new feature would be the upcoming ndjson-related changes after #49470

@bbovenzi bbovenzi modified the milestones: Airflow 3.1.0, Airflow 3.0.2 May 29, 2025
@bbovenzi bbovenzi added the backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch label May 29, 2025
@bbovenzi bbovenzi merged commit 813f3e3 into apache:main May 29, 2025
44 checks passed
github-actions bot pushed a commit that referenced this pull request May 29, 2025
…50746)

* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
(cherry picked from commit 813f3e3)

Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>
Copy link

Backport successfully created: v3-0-test

Status Branch Result
v3-0-test PR Link

@guan404ming guan404ming deleted the refactor-ti-log branch May 29, 2025 14:42
@guan404ming
Copy link
Contributor Author

Thanks!

@jason810496
Copy link
Member

Big thanks @guan404ming 🙌 That's a fantastic improvement, really appreciate your work on this!

pierrejeambrun pushed a commit that referenced this pull request Jun 3, 2025
…50746)

* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
(cherry picked from commit 813f3e3)

Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>
kaxil pushed a commit that referenced this pull request Jun 3, 2025
…50746) (#51202)

* Fix OpenAPI schema for `get_log` API (#50547)

* Fix openapi schema for get_log API

* Fix test_log

(cherry picked from commit 08cc57d)

* [v3-0-test] Update `TaskLogContent` to support virtualized rendering (#50746)

* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
(cherry picked from commit 813f3e3)

Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>

---------

Co-authored-by: LIU ZHE YOU <[email protected]>
Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>
kaxil pushed a commit that referenced this pull request Jun 3, 2025
…50746) (#51202)

* Fix OpenAPI schema for `get_log` API (#50547)

* Fix openapi schema for get_log API

* Fix test_log

(cherry picked from commit 08cc57d)

* [v3-0-test] Update `TaskLogContent` to support virtualized rendering (#50746)

* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
(cherry picked from commit 813f3e3)

Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>

---------

Co-authored-by: LIU ZHE YOU <[email protected]>
Co-authored-by: Guan Ming(Wesley) Chiu <[email protected]>
sanederchik pushed a commit to sanederchik/airflow that referenced this pull request Jun 7, 2025
* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
jose-lehmkuhl pushed a commit to jose-lehmkuhl/airflow that referenced this pull request Jul 11, 2025
* Update TaskLogContent to support virtualized rendering

* Update TaskLogPreview and Logs to handle undefined parsedLogs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:UI Related to UI/UX. For Frontend Developers. backport-to-v3-0-test Mark PR with this label to backport to v3-0-test branch
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants