line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Beam::Minion::Command::job; |
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 ] [-q ] |
8
|
|
|
|
|
|
|
#pod [-t ] [-w] [-l ] [-o ] [] |
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 |
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 >> C<< --state >> |
38
|
|
|
|
|
|
|
#pod |
39
|
|
|
|
|
|
|
#pod Only show jobs with the given C. The state can be one of: C, |
40
|
|
|
|
|
|
|
#pod C, C, or C. |
41
|
|
|
|
|
|
|
#pod |
42
|
|
|
|
|
|
|
#pod =head2 C<< -q >> C<< --queue >> |
43
|
|
|
|
|
|
|
#pod |
44
|
|
|
|
|
|
|
#pod Only show jobs in the given C. Defaults to showing jobs in all queues. |
45
|
|
|
|
|
|
|
#pod The default queue for new jobs is C. |
46
|
|
|
|
|
|
|
#pod |
47
|
|
|
|
|
|
|
#pod =head2 C<< -t >> C<< --task >> |
48
|
|
|
|
|
|
|
#pod |
49
|
|
|
|
|
|
|
#pod Only show jobs matching the given C. L task names are |
50
|
|
|
|
|
|
|
#pod C<< : >>. |
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 >> C<< --limit >> |
57
|
|
|
|
|
|
|
#pod |
58
|
|
|
|
|
|
|
#pod Limit the list to C entries. Defaults to 100. |
59
|
|
|
|
|
|
|
#pod |
60
|
|
|
|
|
|
|
#pod =head2 C<< -o >> C<< --offset >> |
61
|
|
|
|
|
|
|
#pod |
62
|
|
|
|
|
|
|
#pod Skip C 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 for how to set this variable. |
73
|
|
|
|
|
|
|
#pod |
74
|
|
|
|
|
|
|
#pod =head1 SEE ALSO |
75
|
|
|
|
|
|
|
#pod |
76
|
|
|
|
|
|
|
#pod L, L |
77
|
|
|
|
|
|
|
#pod |
78
|
|
|
|
|
|
|
#pod =cut |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
1
|
|
934
|
use Mojo::Base -base; |
|
1
|
|
|
|
|
187421
|
|
|
1
|
|
|
|
|
7
|
|
81
|
1
|
|
|
1
|
|
668
|
use Beam::Minion::Util qw( build_mojo_app ); |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
76
|
|
82
|
1
|
|
|
1
|
|
477
|
use Minion::Command::minion::job; |
|
1
|
|
|
|
|
1712
|
|
|
1
|
|
|
|
|
11
|
|
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
has app => sub { build_mojo_app() }; |
85
|
|
|
|
|
|
|
sub run { |
86
|
3
|
|
|
3
|
0
|
5655
|
my ( $self, @args ) = @_; |
87
|
3
|
|
|
|
|
15
|
my $cmd = Minion::Command::minion::job->new( app => $self->app ); |
88
|
2
|
|
|
|
|
111
|
$cmd->run( @args ); |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
__END__ |