2015-03-27 09:04:25 +00:00
|
|
|
#
|
|
|
|
# spec file for package perl-Minion
|
|
|
|
#
|
|
|
|
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
|
|
|
|
#
|
|
|
|
# All modifications and additions to the file contributed by third parties
|
|
|
|
# remain the property of their copyright owners, unless otherwise agreed
|
|
|
|
# upon. The license for this file, and modifications and additions to the
|
|
|
|
# file, is the same license as for the pristine package itself (unless the
|
|
|
|
# license for the pristine package is not an Open Source License, in which
|
|
|
|
# case the license is the MIT License). An "Open Source License" is a
|
|
|
|
# license that conforms to the Open Source Definition (Version 1.9)
|
|
|
|
# published by the Open Source Initiative.
|
|
|
|
|
|
|
|
# Please submit bugfixes or comments via http://bugs.opensuse.org/
|
|
|
|
#
|
|
|
|
|
|
|
|
|
|
|
|
Name: perl-Minion
|
2015-11-14 10:58:01 +00:00
|
|
|
Version: 4.01
|
2015-03-27 09:04:25 +00:00
|
|
|
Release: 0
|
|
|
|
%define cpan_name Minion
|
|
|
|
Summary: Job queue
|
|
|
|
License: Artistic-2.0
|
|
|
|
Group: Development/Libraries/Perl
|
|
|
|
Url: http://search.cpan.org/dist/Minion/
|
2015-04-22 13:58:51 +00:00
|
|
|
Source0: http://www.cpan.org/authors/id/S/SR/SRI/%{cpan_name}-%{version}.tar.gz
|
|
|
|
Source1: cpanspec.yml
|
2015-03-27 09:04:25 +00:00
|
|
|
BuildArch: noarch
|
|
|
|
BuildRoot: %{_tmppath}/%{name}-%{version}-build
|
|
|
|
BuildRequires: perl
|
|
|
|
BuildRequires: perl-macros
|
|
|
|
BuildRequires: perl(Mojolicious) >= 6.0
|
|
|
|
Requires: perl(Mojolicious) >= 6.0
|
|
|
|
%{perl_requires}
|
|
|
|
|
|
|
|
%description
|
2015-11-11 14:56:10 +00:00
|
|
|
Minion is a job queue for the Mojolicious|http://mojolicio.us real-time web
|
2015-10-31 18:36:37 +00:00
|
|
|
framework with support for multiple named queues, priorities, delayed jobs,
|
|
|
|
job results, retries with backoff, distributed workers, parallel processing
|
2015-11-11 14:56:10 +00:00
|
|
|
and multiple backends (such as PostgreSQL|http://www.postgresql.org).
|
2015-03-27 09:04:25 +00:00
|
|
|
|
|
|
|
A job queue allows you to process time and/or computationally intensive
|
|
|
|
tasks in background processes, outside of the request/response lifecycle.
|
|
|
|
Among those tasks you'll commonly find image resizing, spam filtering, HTTP
|
|
|
|
downloads, building tarballs, warming caches and basically everything else
|
|
|
|
you can imagine that's not super fast.
|
|
|
|
|
|
|
|
use Mojolicious::Lite;
|
|
|
|
|
|
|
|
plugin Minion => {Pg => 'postgresql://sri:s3cret@localhost/test'};
|
|
|
|
|
|
|
|
# Slow task
|
|
|
|
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');
|
|
|
|
});
|
|
|
|
|
|
|
|
# Perform job in a background worker process
|
|
|
|
get '/' => sub {
|
|
|
|
my $c = shift;
|
|
|
|
$c->minion->enqueue('poke_mojo');
|
|
|
|
$c->render(text => 'We will poke mojolicio.us for you soon.');
|
|
|
|
};
|
|
|
|
|
|
|
|
app->start;
|
|
|
|
|
2015-11-11 14:56:10 +00:00
|
|
|
Background worker processes are usually started with the command
|
|
|
|
Minion::Command::minion::worker, which becomes automatically available when
|
|
|
|
an application loads the plugin Mojolicious::Plugin::Minion.
|
2015-03-27 09:04:25 +00:00
|
|
|
|
|
|
|
$ ./myapp.pl minion worker
|
|
|
|
|
2015-11-11 14:56:10 +00:00
|
|
|
Jobs can be managed right from the command line with
|
|
|
|
Minion::Command::minion::job.
|
2015-03-27 09:04:25 +00:00
|
|
|
|
|
|
|
$ ./myapp.pl minion job
|
|
|
|
|
|
|
|
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
|
2015-11-11 14:56:10 +00:00
|
|
|
on /"remove_after". While individual workers can fail in the middle of
|
|
|
|
processing a job, the system will detect this and ensure that no job is
|
|
|
|
left in an uncertain state, depending on /"missing_after".
|
2015-03-27 09:04:25 +00:00
|
|
|
|
|
|
|
%prep
|
|
|
|
%setup -q -n %{cpan_name}-%{version}
|
|
|
|
|
|
|
|
%build
|
|
|
|
%{__perl} Makefile.PL INSTALLDIRS=vendor
|
|
|
|
%{__make} %{?_smp_mflags}
|
|
|
|
|
|
|
|
%check
|
|
|
|
%{__make} test
|
|
|
|
|
|
|
|
%install
|
|
|
|
%perl_make_install
|
|
|
|
%perl_process_packlist
|
|
|
|
%perl_gen_filelist
|
|
|
|
|
|
|
|
%files -f %{name}.files
|
|
|
|
%defattr(-,root,root,755)
|
|
|
|
%doc Changes CONTRIBUTING.md LICENSE README.md
|
|
|
|
|
|
|
|
%changelog
|