| 1 | package Beam::Minion::Command::worker; | ||
| 2 | 2 | our $VERSION = '0.016'; | |
| 3 | # ABSTRACT: Command to run a Beam::Minion worker | ||
| 4 | |||
| 5 | #pod =head1 SYNOPSIS | ||
| 6 | #pod | ||
| 7 | #pod beam minion worker | ||
| 8 | #pod | ||
| 9 | #pod =head1 DESCRIPTION | ||
| 10 | #pod | ||
| 11 | #pod This command takes all the L<Beam::Wire> containers located on the | ||
| 12 | #pod C<BEAM_PATH> environment variable and starts a L<Minion::Worker> worker | ||
| 13 | #pod that will run any services inside. | ||
| 14 | #pod | ||
| 15 | #pod Service jobs are added to the queue using the L<beam minion run | ||
| 16 | #pod command|Beam::Minion::Command::run>. | ||
| 17 | #pod | ||
| 18 | #pod =head1 ENVIRONMENT | ||
| 19 | #pod | ||
| 20 | #pod =head2 BEAM_MINION | ||
| 21 | #pod | ||
| 22 | #pod This variable defines the shared database to coordinate the Minion workers. This | ||
| 23 | #pod database is used to queue the job. This must be the same for all workers | ||
| 24 | #pod and every job running. | ||
| 25 | #pod | ||
| 26 | #pod See L<Beam::Minion/Getting Started> for how to set this variable. | ||
| 27 | #pod | ||
| 28 | #pod =head2 BEAM_PATH | ||
| 29 | #pod | ||
| 30 | #pod This variable is a colon-separated list of directories to search for | ||
| 31 | #pod containers. | ||
| 32 | #pod | ||
| 33 | #pod =head1 SEE ALSO | ||
| 34 | #pod | ||
| 35 | #pod L<Beam::Minion>, L<Minion> | ||
| 36 | #pod | ||
| 37 | #pod =cut | ||
| 38 | |||
| 39 | 2 | ▶ | use Mojo::Base -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 40 | 2 | ▶ | use Beam::Minion::Util qw( build_mojo_app ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 41 | 2 | ▶ | use Minion::Command::minion::worker; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 42 | |||
| 43 | 2 | ▶ | has app => sub { build_mojo_app() }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 44 | sub run { | ||
| 45 | 2 | ▶ | my ( $self, @args ) = @_; |
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 46 | 2 | my $cmd = Minion::Command::minion::worker->new( app => $self->app ); | |
| 47 | 1 | $cmd->run( @args ); | |
| 48 | } | ||
| 49 | |||
| 50 | 2 | 1; | |
| 51 | |||
| 52 | __END__ | ||