| 1 | package Beam::Minion::Command::job; | ||
| 2 | 2 | our $VERSION = '0.016'; | |
| 3 | # ABSTRACT: Command to manage minion jobs | ||
| 4 | |||
| 5 | #pod =head1 SYNOPSIS | ||
| 6 | #pod | ||
| 7 | #pod beam minion job [-R] [-f] [--remove] [-S <state>] [-q <queue>] | ||
| 8 | #pod [-t <task>] [-w] [-l <limit>] [-o <offset>] [<id>] | ||
| 9 | #pod | ||
| 10 | #pod =head1 DESCRIPTION | ||
| 11 | #pod | ||
| 12 | #pod This command manages the minion queue, lists jobs, lists workers, and | ||
| 13 | #pod allows re-running failed jobs. | ||
| 14 | #pod | ||
| 15 | #pod =head1 ARGUMENTS | ||
| 16 | #pod | ||
| 17 | #pod =head2 <id> | ||
| 18 | #pod | ||
| 19 | #pod The ID of a job or worker (with the C<-w> option) to display. | ||
| 20 | #pod | ||
| 21 | #pod =head1 OPTIONS | ||
| 22 | #pod | ||
| 23 | #pod =head2 C<-R> C<--retry> | ||
| 24 | #pod | ||
| 25 | #pod Retry the given job by putting it back in the queue. See C<-f> to retry | ||
| 26 | #pod the job in the current process. | ||
| 27 | #pod | ||
| 28 | #pod =head2 C<-f> C<--foreground> | ||
| 29 | #pod | ||
| 30 | #pod Retry the given jobs right away in the current process (useful for | ||
| 31 | #pod debugging). See C<-R> to retry the job in the queue. | ||
| 32 | #pod | ||
| 33 | #pod =head2 C<--remove> | ||
| 34 | #pod | ||
| 35 | #pod Remove the given job(s) from the database. | ||
| 36 | #pod | ||
| 37 | #pod =head2 C<< -S <state> >> C<< --state <state> >> | ||
| 38 | #pod | ||
| 39 | #pod Only show jobs with the given C<state>. The state can be one of: C<inactive>, | ||
| 40 | #pod C<active>, C<finished>, or C<failed>. | ||
| 41 | #pod | ||
| 42 | #pod =head2 C<< -q <queue> >> C<< --queue <queue> >> | ||
| 43 | #pod | ||
| 44 | #pod Only show jobs in the given C<queue>. Defaults to showing jobs in all queues. | ||
| 45 | #pod The default queue for new jobs is C<default>. | ||
| 46 | #pod | ||
| 47 | #pod =head2 C<< -t <task> >> C<< --task <task> >> | ||
| 48 | #pod | ||
| 49 | #pod Only show jobs matching the given C<task>. L<Beam::Minion> task names are | ||
| 50 | #pod C<< <container>:<service> >>. | ||
| 51 | #pod | ||
| 52 | #pod =head2 C<-w> C<--workers> | ||
| 53 | #pod | ||
| 54 | #pod List workers instead of jobs. | ||
| 55 | #pod | ||
| 56 | #pod =head2 C<< -l <limit> >> C<< --limit <limit> >> | ||
| 57 | #pod | ||
| 58 | #pod Limit the list to C<limit> entries. Defaults to 100. | ||
| 59 | #pod | ||
| 60 | #pod =head2 C<< -o <offset> >> C<< --offset <offset> >> | ||
| 61 | #pod | ||
| 62 | #pod Skip C<offset> jobs when listing. Defaults to 0. | ||
| 63 | #pod | ||
| 64 | #pod =head1 ENVIRONMENT | ||
| 65 | #pod | ||
| 66 | #pod =head2 BEAM_MINION | ||
| 67 | #pod | ||
| 68 | #pod This variable defines the shared database to coordinate the Minion workers. This | ||
| 69 | #pod database is used to queue the job. This must be the same for all workers | ||
| 70 | #pod and every job running. | ||
| 71 | #pod | ||
| 72 | #pod See L<Beam::Minion/Getting Started> for how to set this variable. | ||
| 73 | #pod | ||
| 74 | #pod =head1 SEE ALSO | ||
| 75 | #pod | ||
| 76 | #pod L<Beam::Minion>, L<Minion> | ||
| 77 | #pod | ||
| 78 | #pod =cut | ||
| 79 | |||
| 80 | 2 | ▶ | use Mojo::Base -base; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 81 | 2 | ▶ | use Beam::Minion::Util qw( build_mojo_app ); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 82 | 2 | ▶ | use Minion::Command::minion::job; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 83 | |||
| 84 | 3 | ▶ | has app => sub { build_mojo_app() }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 85 | sub run { | ||
| 86 | 3 | ▶ | my ( $self, @args ) = @_; |
|
Subroutine
run: called CC=1 SCAR=0.0
Pod
undocumented
| |||
| 87 | 3 | my $cmd = Minion::Command::minion::job->new( app => $self->app ); | |
| 88 | 2 | $cmd->run( @args ); | |
| 89 | } | ||
| 90 | |||
| 91 | 2 | 1; | |
| 92 | |||
| 93 | __END__ | ||