Bug 39772 - Background jobs page lists unknown job types for jobs implemented by plugins
Summary: Background jobs page lists unknown job types for jobs implemented by plugins
Status: Pushed to main
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: HKS3 Tadeusz Sośnierz
QA Contact: Martin Renvoize (ashimema)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-04-29 12:20 UTC by HKS3 Tadeusz Sośnierz
Modified: 2025-05-06 16:54 UTC (History)
4 users (show)

See Also:
GIT URL:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
25.05.00
Circulation function:


Attachments
Bug 39772: Display package names for plugin jobs rather than "unknown" messages (2.65 KB, patch)
2025-04-29 12:24 UTC, HKS3 Tadeusz Sośnierz
Details | Diff | Splinter Review
Bug 39772: Extend background_tasks API to allow for human-readable job names (6.94 KB, patch)
2025-04-30 10:10 UTC, HKS3 Tadeusz Sośnierz
Details | Diff | Splinter Review
Bug 39772: Display package names for plugin jobs rather than "unknown" messages (2.70 KB, patch)
2025-05-02 11:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 39772: Extend background_tasks API to allow for human-readable job names (6.98 KB, patch)
2025-05-02 11:53 UTC, David Nind
Details | Diff | Splinter Review
Bug 39772: Display package names for plugin jobs rather than "unknown" messages (2.77 KB, patch)
2025-05-02 13:52 UTC, Martin Renvoize (ashimema)
Details | Diff | Splinter Review
Bug 39772: Extend background_tasks API to allow for human-readable job names (7.10 KB, patch)
2025-05-02 13:52 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 HKS3 Tadeusz Sośnierz 2025-04-29 12:20:24 UTC
Currently the jobs page lists a job type of "Unknown job type 'plugin_*'" for all plugin-sourced jobs. While we don't currently have an institution of a human-readable job name, anything not looking like an error would be an improvement here.
Comment 1 HKS3 Tadeusz Sośnierz 2025-04-29 12:24:33 UTC
Created attachment 181648 [details] [review]
Bug 39772: Display package names for plugin jobs rather than "unknown" messages

This slightly improves the current situation, where on background_jobs.pl
each plugin job would be displayed as "Unknown job type 'plugin_...'".
After this patch, we display the implementing package name
(sourced from plugins' background_tasks()), which is slightly more
human-friendly and significantly less error-looking.

Test plan:

1. In KTD, install a plugin implementing background jobs (e.g. the KitchenSink)
2. On http://localhost:8081/cgi-bin/koha/plugins/plugins-home.pl,
   enable the plugin and run a tool/report from it
3. Observe ugly job types column on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
4. Apply the patch
5. Observe the improved job types on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
Comment 2 HKS3 Tadeusz Sośnierz 2025-04-29 12:25:39 UTC
Happy to discuss other possible improvements – perhaps job-specific metadata with human readable (and translatable?) names in them. This, however should be a relatively non-invasive and yet noticeable improvement.
Comment 3 David Nind 2025-04-29 14:05:02 UTC
Using the kitchen sink plugin (https://github.com/bywatersolutions/dev-koha-plugin-kitchen-sink/releases) no longer seems to work for me:
1. Actions > Run report: Error 500 page
2. Actions > Run tool: 403 CSRF token error after "Click me"
3. Actions > Run admin tool: no background job

I added an assignee.
Comment 4 Tomás Cohen Arazi (tcohen) 2025-04-29 14:51:00 UTC
(In reply to HKS3 Tadeusz Sośnierz from comment #2)
> Happy to discuss other possible improvements – perhaps job-specific metadata
> with human readable (and translatable?) names in them. This, however should
> be a relatively non-invasive and yet noticeable improvement.

I think this is a good first step.

Ideally, we should either add a new hook for plugins to provide descriptions for background job types (e.g. `background_tasks_descriptions`), or even change the `background_tasks` return data structure to include descriptions.

In such scenario, what you do here would be the fallback for when the plugin doesn't provide descriptions.

So move forward.
Comment 5 HKS3 Tadeusz Sośnierz 2025-04-30 10:10:31 UTC
Created attachment 181712 [details] [review]
Bug 39772: Extend background_tasks API to allow for human-readable job names
Comment 6 David Nind 2025-05-01 23:11:22 UTC
Any suggestions for another plugin to test this with? The kitchen sink plugin doesn't seem to work for me - see comment #3.
Comment 7 HKS3 Tadeusz Sośnierz 2025-05-02 08:02:54 UTC
https://github.com/HKS3/koha-normalize-marc2db is a good testcase. Its https://github.com/HKS3/koha-normalize-marc2db/tree/tadzik/custom-job-names branch utilizes the new API for customized job names too.
Comment 8 David Nind 2025-05-02 11:53:04 UTC
Created attachment 181853 [details] [review]
Bug 39772: Display package names for plugin jobs rather than "unknown" messages

This slightly improves the current situation, where on background_jobs.pl
each plugin job would be displayed as "Unknown job type 'plugin_...'".
After this patch, we display the implementing package name
(sourced from plugins' background_tasks()), which is slightly more
human-friendly and significantly less error-looking.

Test plan:

1. In KTD, install a plugin implementing background jobs (e.g. the KitchenSink)
2. On http://localhost:8081/cgi-bin/koha/plugins/plugins-home.pl,
   enable the plugin and run a tool/report from it
3. Observe ugly job types column on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
4. Apply the patch
5. Observe the improved job types on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl

Signed-off-by: David Nind <david@davidnind.com>
Comment 9 David Nind 2025-05-02 11:53:06 UTC
Created attachment 181854 [details] [review]
Bug 39772: Extend background_tasks API to allow for human-readable job names

Signed-off-by: David Nind <david@davidnind.com>
Comment 10 David Nind 2025-05-02 11:53:31 UTC
(In reply to HKS3 Tadeusz Sośnierz from comment #7)
> https://github.com/HKS3/koha-normalize-marc2db is a good testcase. Its
> https://github.com/HKS3/koha-normalize-marc2db/tree/tadzik/custom-job-names
> branch utilizes the new API for customized job names too.

Thanks!
Comment 11 Martin Renvoize (ashimema) 2025-05-02 13:52:24 UTC
Created attachment 181866 [details] [review]
Bug 39772: Display package names for plugin jobs rather than "unknown" messages

This slightly improves the current situation, where on background_jobs.pl
each plugin job would be displayed as "Unknown job type 'plugin_...'".
After this patch, we display the implementing package name
(sourced from plugins' background_tasks()), which is slightly more
human-friendly and significantly less error-looking.

Test plan:

1. In KTD, install a plugin implementing background jobs (e.g. the KitchenSink)
2. On http://localhost:8081/cgi-bin/koha/plugins/plugins-home.pl,
   enable the plugin and run a tool/report from it
3. Observe ugly job types column on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl
4. Apply the patch
5. Observe the improved job types on http://localhost:8081/cgi-bin/koha/admin/background_jobs.pl

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 12 Martin Renvoize (ashimema) 2025-05-02 13:52:27 UTC
Created attachment 181867 [details] [review]
Bug 39772: Extend background_tasks API to allow for human-readable job names

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Comment 13 Martin Renvoize (ashimema) 2025-05-02 13:52:52 UTC
Nice improvement, no regressions, Passing QA
Comment 14 Katrin Fischer 2025-05-06 16:54:14 UTC
Pushed for 25.05!

Well done everyone, thank you!