Bugzilla – Attachment 116931 Details for
Bug 27344
Implement Elastic's update_index_background using Koha::BackgroundJob
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 27344: Add --job-type to background_jobs_worker.pl
Bug-27344-Add---job-type-to-backgroundjobsworkerpl.patch (text/plain), 2.67 KB, created by
Jonathan Druart
on 2021-02-17 09:54:21 UTC
(
hide
)
Description:
Bug 27344: Add --job-type to background_jobs_worker.pl
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2021-02-17 09:54:21 UTC
Size:
2.67 KB
patch
obsolete
>From 4261c3143b9ef7ce569d132f9f53af65c4080a79 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Wed, 17 Feb 2021 10:52:57 +0100 >Subject: [PATCH] Bug 27344: Add --job-type to background_jobs_worker.pl > >This will let sysop adjust the number of workers and how they want to >manage them. >For instance one could want to have one worker for ES indexation and >another worker for other jobs, to prevent ES index to be stuck behind >bigger batch process. >--- > misc/background_jobs_worker.pl | 52 +++++++++++++++++++++++++++++++++- > 1 file changed, 51 insertions(+), 1 deletion(-) > >diff --git a/misc/background_jobs_worker.pl b/misc/background_jobs_worker.pl >index 681eed04c0..2bf7318939 100755 >--- a/misc/background_jobs_worker.pl >+++ b/misc/background_jobs_worker.pl >@@ -15,12 +15,53 @@ > # You should have received a copy of the GNU General Public License > # along with Koha; if not, see <http://www.gnu.org/licenses>. > >+=head1 NAME >+ >+background_jobs_worker.pl - Worker script that will process backgroung jobs >+ >+=head1 SYNOPSIS >+ >+./background_jobs_worker.pl [--job-type] >+ >+=head1 DESCRIPTION >+ >+This script will connect to the Stomp server (RabbitMQ) and subscribe to the different destination queues available. >+You can specify some queues only (using --job-type) if you want to run several workers that will handle their own jobs. >+ >+=head1 OPTIONS >+ >+=over >+ >+=item B<--job-type> >+ >+Give the job types this worker will process. >+ >+The different values available are: >+ >+ batch_biblio_record_modification >+ batch_authority_record_modification >+ update_elastic_index >+ >+=back >+ >+=cut >+ > use Modern::Perl; > use JSON qw( encode_json decode_json ); > use Try::Tiny; >+use Pod::Usage; >+use Getopt::Long; > > use Koha::BackgroundJobs; > >+my ( $help, @job_types ); >+GetOptions( >+ 'h|help' => \$help, >+ 'job-type:s' => \@job_types, >+) || pod2usage(1); >+ >+pod2usage(0) if $help; >+ > my $conn; > try { > $conn = Koha::BackgroundJob->connect; >@@ -28,12 +69,21 @@ try { > warn sprintf "Cannot connect to the message broker, the jobs will be processed anyway (%s)", $_; > }; > >-my @job_types = qw( >+my @available_job_types = qw( > batch_biblio_record_modification > batch_authority_record_modification > update_elastic_index > ); > >+if ( @job_types ) { >+ for my $job_type ( @job_types ) { >+ pod2usage( -verbose => 1, -msg => sprintf "You specify an invalid --job-type value: %s\n", $job_type ) >+ unless grep { $_ eq $job_type } @available_job_types; >+ } >+} else { >+ @job_types = @available_job_types; >+} >+ > if ( $conn ) { > # FIXME cf note in Koha::BackgroundJob about $namespace > my $namespace = C4::Context->config('memcached_namespace'); >-- >2.20.1
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27344
:
114877
|
116252
|
116931
|
132444
|
132445
|
132446
|
132586
|
132609
|
132610
|
132611
|
132612
|
132613
|
132645
|
132646
|
132794
|
132795
|
132796
|
132797
|
132798
|
132843
|
132844
|
132845
|
132969
|
132970
|
132994
|
132995
|
133033
|
134406
|
134407
|
134408
|
134409
|
134410
|
134411
|
134412
|
134413