Bug 37888 - Default filtering of background jobs could be improved
Summary: Default filtering of background jobs could be improved
Status: Needs documenting
Alias: None
Product: Koha
Classification: Unclassified
Component: System Administration (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Julian Maurice
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on: 37905
Blocks:
  Show dependency treegraph
 
Reported: 2024-09-11 07:20 UTC by Martin Renvoize (ashimema)
Modified: 2024-11-22 09:33 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
This updates the display and filter option for background jobs. By default the background jobs page now shows the most recently queued jobs, whatever their status is, and allows to filter on the current pending and running jobs.
Version(s) released in:
24.11.00
Circulation function:


Attachments
Bug 37888: Show all jobs, order by "queued", remove last hour filter (3.58 KB, patch)
2024-10-04 12:04 UTC, Julian Maurice
Details | Diff | Splinter Review
Bug 37888: Show all jobs, order by "queued", remove last hour filter (3.63 KB, patch)
2024-10-07 22:50 UTC, Eric Phetteplace
Details | Diff | Splinter Review
Bug 37888: Show all jobs, order by "queued", remove last hour filter (3.70 KB, patch)
2024-10-17 15:19 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Renvoize (ashimema) 2024-09-11 07:20:01 UTC
From Julian:

I don't like the two available filters and the fact that they are enabled by default. 99% of the time I see an empty table because the jobs I just launched are already finished by the time I go to this page or because the job I want to check was queued more than an hour ago.
Why don't we display the last X queued jobs by default ? I don't want to see unfinished jobs or "queued less than an hour ago" jobs. I want to see the more recent jobs.
An option to filter out finished jobs is useful but in my case it would be less annoying if it was disabled by default.
However, the 1 hour filter is arbitrary (why 1 hour ?) and not so useful in my opinion, as long as we can sort by queued date/time
Comment 1 Eric Phetteplace 2024-09-11 15:57:57 UTC
I agree that for my purposes seeing the last X jobs is probably better than last hour. A filter for unfinished jobs would definitely be helpful. I am almost always checking on a batch metadata ingest and I just want to keep tabs on only that until it finishes.
Comment 2 Julian Maurice 2024-10-04 12:04:19 UTC
Created attachment 172388 [details] [review]
Bug 37888: Show all jobs, order by "queued", remove last hour filter

By default the background jobs page now shows the most recently queued
jobs, whatever their status is.

By doing that, the jobs enqueued less an hour ago are always visible if
there are any (well, the first page at least), so the "last hour" filter
becomes way less useful and it's better to remove it as it caused
problems (see bug 37905) and the "1 hour" duration was arbitrary.

The "current jobs only" filter is still useful as lots of quick
background jobs can push running jobs away from the first page and it's
a common use case to list running jobs

Test plan:
1. Start some background jobs (batch item modification for instance)
2. Make them run and wait for finish
3. Stop the background jobs workers
4. Start some more background jobs
5. You should now have running and non-running background jobs. Go to
   the admin background jobs page
6. Verify that all background jobs are shown and that they ordered by
   queued time (last queued job first)
7. Verify that "Current jobs only" filter still works
Comment 3 Eric Phetteplace 2024-10-04 20:18:04 UTC Comment hidden (obsolete)
Comment 4 Eric Phetteplace 2024-10-04 20:58:35 UTC Comment hidden (obsolete)
Comment 5 Julian Maurice 2024-10-07 06:44:50 UTC
(In reply to Eric Phetteplace from comment #3)
> I can't get this patch to apply against main.
The patch depends on bug 37905. You need to apply it first.

(In reply to Eric Phetteplace from comment #4)
> If I'm not mistaken, the patch also needs to update the `query_filters`
> function on lines 262-72 here
> https://gitlab.com/koha-community/Koha/-/blob/main/koha-tmpl/intranet-tmpl/
> prog/en/modules/admin/background_jobs.tt#L262-272 since the
> #include_last_hour element no longer exists.

the query_filters function is removed by bug 37905
Comment 6 Eric Phetteplace 2024-10-07 18:49:26 UTC
OK my apologies! I've never signed off on a bug where I needed to apply a dependent patch. I should be able to QA this today or tomorrow.
Comment 7 Eric Phetteplace 2024-10-07 22:50:05 UTC
Created attachment 172503 [details] [review]
Bug 37888: Show all jobs, order by "queued", remove last hour filter
Comment 8 Julian Maurice 2024-10-08 07:02:27 UTC
(In reply to Eric Phetteplace from comment #6)
> OK my apologies! I've never signed off on a bug where I needed to apply a
> dependent patch. I should be able to QA this today or tomorrow.
No need for apologies, we've all been there ;)
Thank you for testing!
Comment 9 Martin Renvoize (ashimema) 2024-10-17 15:19:41 UTC
Created attachment 172905 [details] [review]
Bug 37888: Show all jobs, order by "queued", remove last hour filter

By default the background jobs page now shows the most recently queued
jobs, whatever their status is.

By doing that, the jobs enqueued less an hour ago are always visible if
there are any (well, the first page at least), so the "last hour" filter
becomes way less useful and it's better to remove it as it caused
problems (see bug 37905) and the "1 hour" duration was arbitrary.

The "current jobs only" filter is still useful as lots of quick
background jobs can push running jobs away from the first page and it's
a common use case to list running jobs

Test plan:
1. Start some background jobs (batch item modification for instance)
2. Make them run and wait for finish
3. Stop the background jobs workers
4. Start some more background jobs
5. You should now have running and non-running background jobs. Go to
   the admin background jobs page
6. Verify that all background jobs are shown and that they ordered by
   queued time (last queued job first)
7. Verify that "Current jobs only" filter still works

Signed-off-by: Eric Phetteplace <phette23@gmail.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 10 Martin Renvoize (ashimema) 2024-10-17 15:20:23 UTC
Simpler and cleaner UX with this.. Passing QA
Comment 11 Katrin Fischer 2024-10-24 14:57:02 UTC
Pushed for 24.11!

Well done everyone, thank you!
Comment 12 Lucas Gass (lukeg) 2024-11-18 23:05:28 UTC
Enhancement, no 24.05.x backport