Hello community, here is the log from the commit of package perl-Minion for openSUSE:Factory checked in at 2015-09-08 17:39:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 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 2015-05-18 22:23:21.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.perl-Minion.new/perl-Minion.changes 2015-09-08 17:42:37.000000000 +0200 @@ -1,0 +2,23 @@ +Thu Sep 3 08:50:10 UTC 2015 - co...@suse.com + +- updated to 1.18 + see /usr/share/doc/packages/perl-Minion/Changes + + 1.18 2015-08-30 + - Fixed Makefile.PL to be compliant with version 2 of the CPAN distribution + metadata specification. + +------------------------------------------------------------------- +Sat Aug 29 08:54:57 UTC 2015 - co...@suse.com + +- updated to 1.17 + see /usr/share/doc/packages/perl-Minion/Changes + + 1.17 2015-08-29 + - Fixed bug in worker command where new jobs would still be dequeued after + receiving an INT/TERM signal. + + 1.16 2015-08-28 + - Improved worker command to detect workers without heartbeat a little faster. + +------------------------------------------------------------------- Old: ---- Minion-1.15.tar.gz New: ---- Minion-1.18.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ perl-Minion.spec ++++++ --- /var/tmp/diff_new_pack.VeNizX/_old 2015-09-08 17:42:38.000000000 +0200 +++ /var/tmp/diff_new_pack.VeNizX/_new 2015-09-08 17:42:38.000000000 +0200 @@ -17,7 +17,7 @@ Name: perl-Minion -Version: 1.15 +Version: 1.18 Release: 0 %define cpan_name Minion Summary: Job queue ++++++ Minion-1.15.tar.gz -> Minion-1.18.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/Changes new/Minion-1.18/Changes --- old/Minion-1.15/Changes 2015-05-15 23:42:01.000000000 +0200 +++ new/Minion-1.18/Changes 2015-08-29 13:39:17.000000000 +0200 @@ -1,4 +1,15 @@ +1.18 2015-08-30 + - Fixed Makefile.PL to be compliant with version 2 of the CPAN distribution + metadata specification. + +1.17 2015-08-29 + - Fixed bug in worker command where new jobs would still be dequeued after + receiving an INT/TERM signal. + +1.16 2015-08-28 + - Improved worker command to detect workers without heartbeat a little faster. + 1.15 2015-05-15 - Added support for retrying jobs with a delay. (kwa) - Added delay option to retry method in Minion::Job. (kwa) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/META.json new/Minion-1.18/META.json --- old/Minion-1.15/META.json 2015-05-15 23:43:54.000000000 +0200 +++ new/Minion-1.18/META.json 2015-09-02 19:29:02.000000000 +0200 @@ -3,8 +3,8 @@ "author" : [ "Sebastian Riedel <s...@cpan.org>" ], - "dynamic_config" : 1, - "generated_by" : "ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001", + "dynamic_config" : 0, + "generated_by" : "ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005", "license" : [ "artistic_2" ], @@ -49,9 +49,12 @@ "http://www.opensource.org/licenses/artistic-license-2.0" ], "repository" : { - "url" : "https://github.com/kraih/minion.git" + "type" : "git", + "url" : "https://github.com/kraih/minion.git", + "web" : "https://github.com/kraih/minion" }, "x_IRC" : "irc://irc.perl.org/#mojo" }, - "version" : "1.15" + "version" : "1.18", + "x_serialization_backend" : "JSON::PP version 2.27300" } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/META.yml new/Minion-1.18/META.yml --- old/Minion-1.15/META.yml 2015-05-15 23:43:53.000000000 +0200 +++ new/Minion-1.18/META.yml 2015-09-02 19:29:01.000000000 +0200 @@ -6,8 +6,8 @@ ExtUtils::MakeMaker: '0' configure_requires: ExtUtils::MakeMaker: '0' -dynamic_config: 1 -generated_by: 'ExtUtils::MakeMaker version 7.04, CPAN::Meta::Converter version 2.150001' +dynamic_config: 0 +generated_by: 'ExtUtils::MakeMaker version 7.0401, CPAN::Meta::Converter version 2.150005' license: artistic_2 meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html @@ -28,4 +28,5 @@ homepage: http://mojolicio.us license: http://www.opensource.org/licenses/artistic-license-2.0 repository: https://github.com/kraih/minion.git -version: '1.15' +version: '1.18' +x_serialization_backend: 'CPAN::Meta::YAML version 0.016' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/Makefile.PL new/Minion-1.18/Makefile.PL --- old/Minion-1.15/Makefile.PL 2015-02-28 08:34:42.000000000 +0100 +++ new/Minion-1.18/Makefile.PL 2015-08-29 01:38:36.000000000 +0200 @@ -12,15 +12,21 @@ AUTHOR => 'Sebastian Riedel <s...@cpan.org>', LICENSE => 'artistic_2', META_MERGE => { - requires => {perl => '5.010001'}, - resources => { - license => 'http://www.opensource.org/licenses/artistic-license-2.0', + dynamic_config => 0, + 'meta-spec' => {version => 2}, + no_index => {directory => ['t']}, + prereqs => {runtime => {requires => {perl => '5.010001'}}}, + resources => { + bugtracker => {web => 'https://github.com/kraih/minion/issues'}, homepage => 'http://mojolicio.us', - bugtracker => 'https://github.com/kraih/minion/issues', - repository => 'https://github.com/kraih/minion.git', - x_IRC => 'irc://irc.perl.org/#mojo' + license => ['http://www.opensource.org/licenses/artistic-license-2.0'], + repository => { + type => 'git', + url => 'https://github.com/kraih/minion.git', + web => 'https://github.com/kraih/minion', + }, + x_IRC => 'irc://irc.perl.org/#mojo' }, - no_index => {directory => ['t']} }, PREREQ_PM => {Mojolicious => '6.0', 'DBM::Deep' => '2.0011'}, test => {TESTS => 't/*.t t/*/*.t'} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Backend/File.pm new/Minion-1.18/lib/Minion/Backend/File.pm --- old/Minion-1.15/lib/Minion/Backend/File.pm 2015-05-15 19:41:01.000000000 +0200 +++ new/Minion-1.18/lib/Minion/Backend/File.pm 2015-08-29 01:40:49.000000000 +0200 @@ -15,7 +15,7 @@ sub dequeue { my ($self, $id, $timeout) = @_; - usleep $timeout * 1000000 unless my $job = $self->_try($id); + usleep($timeout * 1000000) unless my $job = $self->_try($id); return $job || $self->_try($id); } @@ -310,6 +310,66 @@ Get information about a job or return C<undef> if job does not exist. + # Check job state + my $state = $backend->job_info($job_id)->{state}; + + # Get job result + my $result = $backend->job_info($job_id)->{result}; + +These fields are currently available: + +=over 2 + +=item args + +Job arguments. + +=item created + +Time job was created. + +=item delayed + +Time job was delayed to. + +=item finished + +Time job was finished. + +=item priority + +Job priority. + +=item result + +Job result. + +=item retried + +Time job has been retried. + +=item retries + +Number of times job has been retried. + +=item started + +Time job was started. + +=item state + +Current job state. + +=item task + +Task name. + +=item worker + +Id of worker that is processing the job. + +=back + =head2 list_jobs my $batch = $backend->list_jobs($offset, $limit); @@ -409,6 +469,35 @@ Get information about a worker or return C<undef> if worker does not exist. + # Check worker host + my $host = $backend->worker_info($worker_id)->{host}; + +These fields are currently available: + +=over 2 + +=item host + +Worker host. + +=item jobs + +Ids of jobs the worker is currently processing. + +=item notified + +Last time worker sent a heartbeat. + +=item pid + +Process id of worker. + +=item started + +Time worker was started. + +=back + =head1 SEE ALSO L<Minion>, L<Mojolicious::Guides>, L<http://mojolicio.us>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Backend/Pg.pm new/Minion-1.18/lib/Minion/Backend/Pg.pm --- old/Minion-1.15/lib/Minion/Backend/Pg.pm 2015-05-15 19:41:14.000000000 +0200 +++ new/Minion-1.18/lib/Minion/Backend/Pg.pm 2015-08-29 01:40:50.000000000 +0200 @@ -151,8 +151,8 @@ my $active = $db->query($sql)->array->[0]; $sql = 'select state, count(state) from minion_jobs group by 1'; - my $states = $db->query($sql) - ->arrays->reduce(sub { $a->{$b->[0]} = $b->[1]; $a }, {}); + my $states + = $db->query($sql)->arrays->reduce(sub { $a->{$b->[0]} = $b->[1]; $a }, {}); return { active_workers => $active, @@ -300,6 +300,66 @@ Get information about a job or return C<undef> if job does not exist. + # Check job state + my $state = $backend->job_info($job_id)->{state}; + + # Get job result + my $result = $backend->job_info($job_id)->{result}; + +These fields are currently available: + +=over 2 + +=item args + +Job arguments. + +=item created + +Time job was created. + +=item delayed + +Time job was delayed to. + +=item finished + +Time job was finished. + +=item priority + +Job priority. + +=item result + +Job result. + +=item retried + +Time job has been retried. + +=item retries + +Number of times job has been retried. + +=item started + +Time job was started. + +=item state + +Current job state. + +=item task + +Task name. + +=item worker + +Id of worker that is processing the job. + +=back + =head2 list_jobs my $batch = $backend->list_jobs($offset, $limit); @@ -399,6 +459,35 @@ Get information about a worker or return C<undef> if worker does not exist. + # Check worker host + my $host = $backend->worker_info($worker_id)->{host}; + +These fields are currently available: + +=over 2 + +=item host + +Worker host. + +=item jobs + +Ids of jobs the worker is currently processing. + +=item notified + +Last time worker sent a heartbeat. + +=item pid + +Process id of worker. + +=item started + +Time worker was started. + +=back + =head1 SEE ALSO L<Minion>, L<Mojolicious::Guides>, L<http://mojolicio.us>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Backend.pm new/Minion-1.18/lib/Minion/Backend.pm --- old/Minion-1.15/lib/Minion/Backend.pm 2015-05-15 19:41:58.000000000 +0200 +++ new/Minion-1.18/lib/Minion/Backend.pm 2015-08-29 01:40:50.000000000 +0200 @@ -136,6 +136,66 @@ Get information about a job or return C<undef> if job does not exist. Meant to be overloaded in a subclass. + # Check job state + my $state = $backend->job_info($job_id)->{state}; + + # Get job result + my $result = $backend->job_info($job_id)->{result}; + +These fields are currently available: + +=over 2 + +=item args + +Job arguments. + +=item created + +Time job was created. + +=item delayed + +Time job was delayed to. + +=item finished + +Time job was finished. + +=item priority + +Job priority. + +=item result + +Job result. + +=item retried + +Time job has been retried. + +=item retries + +Number of times job has been retried. + +=item started + +Time job was started. + +=item state + +Current job state. + +=item task + +Task name. + +=item worker + +Id of worker that is processing the job. + +=back + =head2 list_jobs my $batch = $backend->list_jobs($offset, $limit); @@ -236,6 +296,35 @@ Get information about a worker or return C<undef> if worker does not exist. Meant to be overloaded in a subclass. + # Check worker host + my $host = $backend->worker_info($worker_id)->{host}; + +These fields are currently available: + +=over 2 + +=item host + +Worker host. + +=item jobs + +Ids of jobs the worker is currently processing. + +=item notified + +Last time worker sent a heartbeat. + +=item pid + +Process id of worker. + +=item started + +Time worker was started. + +=back + =head1 SEE ALSO L<Minion>, L<Mojolicious::Guides>, L<http://mojolicio.us>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Command/minion/job.pm new/Minion-1.18/lib/Minion/Command/minion/job.pm --- old/Minion-1.15/lib/Minion/Command/minion/job.pm 2015-05-15 19:34:30.000000000 +0200 +++ new/Minion-1.18/lib/Minion/Command/minion/job.pm 2015-08-29 01:40:51.000000000 +0200 @@ -29,8 +29,7 @@ my $id = @args ? shift @args : undef; # Enqueue - return say $self->app->minion->enqueue($enqueue, $args, $options) - if $enqueue; + return say $self->app->minion->enqueue($enqueue, $args, $options) if $enqueue; # Show stats or list jobs/workers return $self->_stats if $stats; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Command/minion/worker.pm new/Minion-1.18/lib/Minion/Command/minion/worker.pm --- old/Minion-1.15/lib/Minion/Command/minion/worker.pm 2015-03-08 17:31:06.000000000 +0100 +++ new/Minion-1.18/lib/Minion/Command/minion/worker.pm 2015-08-29 01:40:51.000000000 +0200 @@ -44,15 +44,15 @@ $app->log->debug('Checking worker registry and job queue'); my $minion = $app->minion; $minion->repair; - $self->{repair} = time + $minion->remove_after; + $self->{repair} = time + $minion->missing_after; } # Check if jobs are finished my $jobs = $self->{jobs} ||= {}; $jobs->{$_}->is_finished($_) and delete $jobs->{$_} for keys %$jobs; - # Wait if job limit has been reached - if ($self->{max} <= keys %$jobs) { sleep 1 } + # Wait if job limit has been reached or worker is stopping + if (($self->{max} <= keys %$jobs) || $self->{finished}) { sleep 1 } # Try to get more jobs elsif (my $job = $self->{worker}->dequeue(5)) { $jobs->{$job->start} = $job } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Job.pm new/Minion-1.18/lib/Minion/Job.pm --- old/Minion-1.15/lib/Minion/Job.pm 2015-05-15 19:40:49.000000000 +0200 +++ new/Minion-1.18/lib/Minion/Job.pm 2015-08-29 01:40:51.000000000 +0200 @@ -204,6 +204,60 @@ # Get job result my $result = $job->info->{result}; +These fields are currently available: + +=over 2 + +=item args + +Job arguments. + +=item created + +Time job was created. + +=item delayed + +Time job was delayed to. + +=item finished + +Time job was finished. + +=item priority + +Job priority. + +=item result + +Job result. + +=item retried + +Time job has been retried. + +=item retries + +Number of times job has been retried. + +=item started + +Time job was started. + +=item state + +Current job state. + +=item task + +Task name. + +=item worker + +Id of worker that is processing the job. + +=back + =head2 is_finished my $bool = $job->is_finished($pid); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion/Worker.pm new/Minion-1.18/lib/Minion/Worker.pm --- old/Minion-1.15/lib/Minion/Worker.pm 2015-03-07 18:29:30.000000000 +0100 +++ new/Minion-1.18/lib/Minion/Worker.pm 2015-08-29 01:40:52.000000000 +0200 @@ -105,6 +105,35 @@ Get worker information. + # Check worker host + my $host = $worker->info->{host}; + +These fields are currently available: + +=over 2 + +=item host + +Worker host. + +=item jobs + +Ids of jobs the worker is currently processing. + +=item notified + +Last time worker sent a heartbeat. + +=item pid + +Process id of worker. + +=item started + +Time worker was started. + +=back + =head2 register $worker = $worker->register; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/lib/Minion.pm new/Minion-1.18/lib/Minion.pm --- old/Minion-1.15/lib/Minion.pm 2015-05-15 19:40:28.000000000 +0200 +++ new/Minion-1.18/lib/Minion.pm 2015-08-29 01:40:52.000000000 +0200 @@ -15,7 +15,7 @@ has remove_after => 864000; has tasks => sub { {} }; -our $VERSION = '1.15'; +our $VERSION = '1.18'; sub add_task { ($_[0]->tasks->{$_[1]} = $_[2]) and return $_[0] } @@ -158,6 +158,33 @@ processing a job, the system will detect this and ensure that no job is left in an uncertain state, depending on L</"missing_after">. +=head1 GROWING + +And as your application grows, you can move tasks into application specific +plugins. + + package MyApp::Task::PokeMojo; + use Mojo::Base 'Mojolicious::Plugin'; + + sub register { + my ($self, $app) = @_; + $app->minion->add_task(poke_mojo => sub { + my $job = shift; + $job->app->ua->get('mojolicio.us'); + $job->app->log->debug('We have poked mojolicio.us for a visitor'); + }); + } + + 1; + +Which are loaded like any other plugin from your application. + + # Mojolicious + $app->plugin('MyApp::Task::PokeMojo'); + + # Mojolicious::Lite + plugin 'MyApp::Task::PokeMojo'; + =head1 EVENTS L<Minion> inherits all events from L<Mojo::EventEmitter> and can emit the diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/Minion-1.15/t/pg.t new/Minion-1.18/t/pg.t --- old/Minion-1.15/t/pg.t 2015-05-15 18:33:39.000000000 +0200 +++ new/Minion-1.18/t/pg.t 2015-08-29 01:39:15.000000000 +0200 @@ -4,8 +4,7 @@ use Test::More; -plan skip_all => 'set TEST_ONLINE to enable this test' - unless $ENV{TEST_ONLINE}; +plan skip_all => 'set TEST_ONLINE to enable this test' unless $ENV{TEST_ONLINE}; use Minion; use Mojo::IOLoop; @@ -125,8 +124,7 @@ ok !$minion->backend->pg->db->query( 'select count(id) as count from minion_jobs')->hash->{count}, 'no jobs'; ok !$minion->backend->pg->db->query( - 'select count(id) as count from minion_workers')->hash->{count}, - 'no workers'; + 'select count(id) as count from minion_workers')->hash->{count}, 'no workers'; # Wait for job my $before = time;