Hello community, here is the log from the commit of package perl-Minion for openSUSE:Factory checked in at 2016-09-07 11:45:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/perl-Minion (Old) and /work/SRC/openSUSE:Factory/.perl-Minion.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "perl-Minion" Changes: -------- --- /work/SRC/openSUSE:Factory/perl-Minion/perl-Minion.changes 2016-05-25 21:29:36.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Minion.new/perl-Minion.changes 2016-09-07 11:45:07.000000000 +0200 @@ -1,0 +2,11 @@ +Fri Sep 2 05:41:32 UTC 2016 - [email protected] + +- updated to 5.09 + see /usr/share/doc/packages/perl-Minion/Changes + + 5.09 2016-08-31 + - Added EXPERIMENTAL enqueued_jobs field to stats methods in Minion and + Minion::Backend::Pg. + - Improved Minion::Backend::Pg performance slightly with a new index. + +------------------------------------------------------------------- Old: ---- Minion-5.08.tar.gz New: ---- Minion-5.09.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Minion.spec ++++++ --- /var/tmp/diff_new_pack.hxfqn4/_old 2016-09-07 11:45:08.000000000 +0200 +++ /var/tmp/diff_new_pack.hxfqn4/_new 2016-09-07 11:45:08.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Minion -Version: 5.08 +Version: 5.09 Release: 0 %define cpan_name Minion Summary: Job queue @@ -78,6 +78,21 @@ $ ./myapp.pl minion job +To manage background worker processes with systemd, you can use a unit +configuration file like this. + + [Unit] + Description=My Mojolicious application workers + After=postgresql.service + + [Service] + Type=simple + ExecStart=/home/sri/myapp/myapp.pl minion worker -m production + KillMode=process + + [Install] + WantedBy=multi-user.target + Every job can fail or succeed, but not get lost, the system is eventually consistent and will preserve job results for as long as you like, depending on "remove_after". While individual workers can fail in the middle of ++++++ Minion-5.08.tar.gz -> Minion-5.09.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/Changes new/Minion-5.09/Changes --- old/Minion-5.08/Changes 2016-05-19 23:33:33.000000000 +0200 +++ new/Minion-5.09/Changes 2016-08-31 19:43:50.000000000 +0200 @@ -1,4 +1,9 @@ +5.09 2016-08-31 + - Added EXPERIMENTAL enqueued_jobs field to stats methods in Minion and + Minion::Backend::Pg. + - Improved Minion::Backend::Pg performance slightly with a new index. + 5.08 2016-05-20 - Improved repair methods not to remove finished jobs with unresolved dependencies. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/META.json new/Minion-5.09/META.json --- old/Minion-5.08/META.json 2016-05-20 02:33:37.000000000 +0200 +++ new/Minion-5.09/META.json 2016-09-01 06:21:57.000000000 +0200 @@ -4,7 +4,7 @@ "Sebastian Riedel <[email protected]>" ], "dynamic_config" : 0, - "generated_by" : "ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005", + "generated_by" : "ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010", "license" : [ "artistic_2" ], @@ -54,6 +54,6 @@ }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "5.08", - "x_serialization_backend" : "JSON::PP version 2.27300" + "version" : "5.09", + "x_serialization_backend" : "JSON::PP version 2.27400" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/META.yml new/Minion-5.09/META.yml --- old/Minion-5.08/META.yml 2016-05-20 02:33:37.000000000 +0200 +++ new/Minion-5.09/META.yml 2016-09-01 06:21:57.000000000 +0200 @@ -7,7 +7,7 @@ configure_requires: ExtUtils::MakeMaker: '0' dynamic_config: 0 -generated_by: 'ExtUtils::MakeMaker version 7.1001, CPAN::Meta::Converter version 2.150005' +generated_by: 'ExtUtils::MakeMaker version 7.24, CPAN::Meta::Converter version 2.150010' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -27,5 +27,5 @@ homepage: http://mojolicious.org license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/minion.git -version: '5.08' +version: '5.09' x_serialization_backend: 'CPAN::Meta::YAML version 0.018' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/lib/Minion/Backend/Pg.pm new/Minion-5.09/lib/Minion/Backend/Pg.pm --- old/Minion-5.08/lib/Minion/Backend/Pg.pm 2016-05-19 17:21:43.000000000 +0200 +++ new/Minion-5.09/lib/Minion/Backend/Pg.pm 2016-08-31 19:55:44.000000000 +0200 @@ -136,14 +136,16 @@ # Old jobs with no unresolved dependencies $db->query( "delete from minion_jobs as j - where finished < now() - interval '1 second' * ? and not exists ( + where finished <= now() - interval '1 second' * ? and not exists ( select 1 from minion_jobs where j.id = any(parents) and state <> 'finished' ) and state = 'finished'", $minion->remove_after ); } -sub reset { shift->pg->db->query('truncate minion_jobs, minion_workers') } +sub reset { + shift->pg->db->query('truncate minion_jobs, minion_workers restart identity'); +} sub retry_job { my ($self, $id, $retries, $options) = (shift, shift, shift, shift || {}); @@ -164,7 +166,10 @@ my $self = shift; my $stats = $self->pg->db->query( - "select state::text || '_jobs', count(*) from minion_jobs group by state + "select 'enqueued_jobs', case when is_called then last_value else 0 end + from minion_jobs_id_seq + union all + select state::text || '_jobs', count(*) from minion_jobs group by state union all select 'delayed_jobs', count(*) from minion_jobs where (delayed > now() or parents <> '{}') and state = 'inactive' @@ -207,7 +212,7 @@ select count(*) from minion_jobs where id = any(j.parents) and state = 'finished' )) and queue = any (?) and state = 'inactive' and task = any (?) - order by priority desc, created + order by priority desc, id limit 1 for update skip locked ) @@ -631,6 +636,13 @@ in the future or have unresolved dependencies. Note that this field is EXPERIMENTAL and might change without warning! +=item enqueued_jobs + + enqueued_jobs => 100000 + +Rough estimate of how many jobs have ever been enqueued. Note that this field is +EXPERIMENTAL and might change without warning! + =item failed_jobs failed_jobs => 100 @@ -773,7 +785,6 @@ -- 8 up alter table minion_jobs add constraint args check(jsonb_typeof(args) = 'array'); -create index on minion_jobs (state, priority desc, created); -- 9 up create or replace function minion_jobs_notify_workers() returns trigger as $$ @@ -798,3 +809,6 @@ -- 10 up alter table minion_jobs add column parents bigint[] default '{}'::bigint[]; + +-- 11 up +create index on minion_jobs (state, priority desc, id); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/lib/Minion.pm new/Minion-5.09/lib/Minion.pm --- old/Minion-5.08/lib/Minion.pm 2016-05-19 06:26:47.000000000 +0200 +++ new/Minion-5.09/lib/Minion.pm 2016-08-31 19:34:19.000000000 +0200 @@ -15,7 +15,7 @@ has remove_after => 172800; has tasks => sub { {} }; -our $VERSION = '5.08'; +our $VERSION = '5.09'; sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] } @@ -161,6 +161,21 @@ $ ./myapp.pl minion job +To manage background worker processes with systemd, you can use a unit +configuration file like this. + + [Unit] + Description=My Mojolicious application workers + After=postgresql.service + + [Service] + Type=simple + ExecStart=/home/sri/myapp/myapp.pl minion worker -m production + KillMode=process + + [Install] + WantedBy=multi-user.target + Every job can fail or succeed, but not get lost, the system is eventually consistent and will preserve job results for as long as you like, depending on L</"remove_after">. While individual workers can fail in the middle of @@ -441,6 +456,13 @@ in the future or have unresolved dependencies. Note that this field is EXPERIMENTAL and might change without warning! +=item enqueued_jobs + + enqueued_jobs => 100000 + +Rough estimate of how many jobs have ever been enqueued. Note that this field is +EXPERIMENTAL and might change without warning! + =item failed_jobs failed_jobs => 100 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-5.08/t/pg.t new/Minion-5.09/t/pg.t --- old/Minion-5.08/t/pg.t 2016-05-19 04:36:04.000000000 +0200 +++ new/Minion-5.09/t/pg.t 2016-08-31 19:55:44.000000000 +0200 @@ -24,11 +24,11 @@ isa_ok $worker->minion->app, 'Mojolicious', 'has default application'; # Migrate up and down -is $minion->backend->pg->migrations->active, 10, 'active version is 10'; +is $minion->backend->pg->migrations->active, 11, 'active version is 11'; is $minion->backend->pg->migrations->migrate(0)->active, 0, 'active version is 0'; -is $minion->backend->pg->migrations->migrate->active, 10, - 'active version is 10'; +is $minion->backend->pg->migrations->migrate->active, 11, + 'active version is 11'; # Register and unregister $worker->register; @@ -144,6 +144,7 @@ my $stats = $minion->stats; is $stats->{active_workers}, 0, 'no active workers'; is $stats->{inactive_workers}, 0, 'no inactive workers'; +is $stats->{enqueued_jobs}, 0, 'no enqueued jobs'; is $stats->{active_jobs}, 0, 'no active jobs'; is $stats->{failed_jobs}, 0, 'no failed jobs'; is $stats->{finished_jobs}, 0, 'no finished jobs'; @@ -152,7 +153,9 @@ $worker = $minion->worker->register; is $minion->stats->{inactive_workers}, 1, 'one inactive worker'; $minion->enqueue('fail'); +is $minion->stats->{enqueued_jobs}, 1, 'one enqueued job'; $minion->enqueue('fail'); +is $minion->stats->{enqueued_jobs}, 2, 'two enqueued jobs'; is $minion->stats->{inactive_jobs}, 2, 'two inactive jobs'; $job = $worker->dequeue(0); $stats = $minion->stats;
