Skip to content
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

refactor(tasks): improve the performance of tasks page #188

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

kyy1996
Copy link

@kyy1996 kyy1996 commented Jun 1, 2021

This commit improve the performance of the task page.

Background

When we have millions of tasks log, it will take a significant duration for loading the task page. When loading the task list, process_tasks will load task result for each task items while only the fail_count, pass_count, total, task_id, result_id of the task result are be used. And each of these fields can be computed by database.

Change Code

This commit refactor the process_tasks method in TasksView class, using group by statement and sum, count functions to compute these statistic fields at database.

Performance

This change has been applied in our intranet, and it improve the loading time of task page from 15s to 1s.

cost of loading time after applied this change

@pep8speaks
Copy link

Hello @kyy1996! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

Line 15:1: F401 'setuptools' imported but unused
Line 28:1: E122 continuation line missing indentation or outdented
Line 40:1: E302 expected 2 blank lines, found 1
Line 47:68: E502 the backslash is redundant between brackets
Line 49:51: E231 missing whitespace after ','
Line 52:66: E502 the backslash is redundant between brackets
Line 60:1: E302 expected 2 blank lines, found 1
Line 87:23: E261 at least two spaces before inline comment
Line 97:10: E261 at least two spaces before inline comment
Line 111:1: E302 expected 2 blank lines, found 1
Line 126:1: E302 expected 2 blank lines, found 1
Line 129:1: E302 expected 2 blank lines, found 1
Line 133:1: E302 expected 2 blank lines, found 1
Line 141:1: E302 expected 2 blank lines, found 1
Line 147:1: E302 expected 2 blank lines, found 1
Line 152:1: E302 expected 2 blank lines, found 1
Line 165:1: E302 expected 2 blank lines, found 1
Line 171:1: E302 expected 2 blank lines, found 1
Line 174:1: E302 expected 2 blank lines, found 1
Line 199:1: E302 expected 2 blank lines, found 1
Line 218:1: E302 expected 2 blank lines, found 1
Line 222:10: E261 at least two spaces before inline comment
Line 230:1: E302 expected 2 blank lines, found 1
Line 252:1: E302 expected 2 blank lines, found 1
Line 267:1: E302 expected 2 blank lines, found 1
Line 278:36: E127 continuation line over-indented for visual indent
Line 279:36: E127 continuation line over-indented for visual indent
Line 280:36: E127 continuation line over-indented for visual indent
Line 281:36: E127 continuation line over-indented for visual indent
Line 286:36: E127 continuation line over-indented for visual indent
Line 287:36: E127 continuation line over-indented for visual indent
Line 288:36: E127 continuation line over-indented for visual indent

Line 17:1: F821 undefined name 'reload'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants