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

Display the total number of tasks matching a filter/query #3889

Merged
merged 2 commits into from Jul 6, 2023

Conversation

Kerollmops
Copy link
Member

@Kerollmops Kerollmops commented Jul 5, 2023

This PR returns a new field on the /tasks routes. The total field exposes the total number of tasks that matches the given filter/query. It is useful to display information on a user interface and can help understand when progress is made in processing tasks, i.e., the total number of tasks on /tasks?statuses=succeeded will increase over time.

Fixes #3888.

How have I implemented it?

I found it much easier to run two times the task filtering system. Once with the original from and limit parameters and a second time without. The second call will return the total number of tasks that match the query, not only the number of tasks on the current page.

So far, in terms of performance, there doesn't seem to be any issue. I tried different filters with something like 250k tasks. Note that there is a limit of 1M tasks in the queue.

@Kerollmops Kerollmops added this to the v1.3.0 milestone Jul 5, 2023
@Kerollmops Kerollmops requested a review from dureuill July 5, 2023 10:04
@Kerollmops Kerollmops linked an issue Jul 5, 2023 that may be closed by this pull request
1 task
@Kerollmops Kerollmops force-pushed the display-total-number-tasks branch 3 times, most recently from 77a73a6 to d406bd2 Compare July 5, 2023 16:40
Copy link
Contributor

@dureuill dureuill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, I think we should add a small comment (see suggestion)

Looks like some tests don't pass (see CI)

Copy link
Contributor

@dureuill dureuill left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bors merge

@meili-bors
Copy link
Contributor

meili-bors bot commented Jul 6, 2023

Build succeeded:

@Kerollmops Kerollmops merged commit ff192bb into release-v1.3.0 Jul 6, 2023
10 checks passed
@Kerollmops Kerollmops deleted the display-total-number-tasks branch July 6, 2023 11:08
@meili-bot meili-bot added the v1.3.0 PRs/issues solved in v1.3.0 released on 2023-07-31 label Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
v1.3.0 PRs/issues solved in v1.3.0 released on 2023-07-31
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Updates to task endpoint
3 participants