| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Job::Async::Client; |
|
2
|
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
659
|
use strict; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
44
|
|
|
4
|
2
|
|
|
2
|
|
8
|
use warnings; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
41
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
2
|
|
|
2
|
|
7
|
use parent qw(IO::Async::Notifier); |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
7
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 NAME |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
Job::Async::Client - client API for L |
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
This is the thing that submits jobs. It sends out a job request |
|
19
|
|
|
|
|
|
|
which hopefully a worker will pick up and process. |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
|
22
|
|
|
|
|
|
|
|
|
23
|
2
|
|
|
2
|
|
11862
|
use Job::Async::Job; |
|
|
2
|
|
|
|
|
3
|
|
|
|
2
|
|
|
|
|
283
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
=head1 METHODS |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
=head2 id |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
Returns this client's ID. Although one can be configured specifically, it |
|
30
|
|
|
|
|
|
|
will default to a random (v4) UUID. |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
|
33
|
|
|
|
|
|
|
|
|
34
|
0
|
|
0
|
0
|
1
|
0
|
sub id { shift->{id} //= Job::Async::Utils::uuid() } |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=head2 timeout |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
Timeout to use for any newly-created jobs. No default. |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
=cut |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
1
|
0
|
sub timeout { shift->{timeout} } |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub configure { |
|
45
|
2
|
|
|
2
|
1
|
660
|
my ($self, %args) = @_; |
|
46
|
2
|
|
|
|
|
5
|
for my $k (qw(id timeout)) { |
|
47
|
4
|
50
|
|
|
|
14
|
$self->{$k} = delete $args{$k} if exists $args{$k}; |
|
48
|
|
|
|
|
|
|
} |
|
49
|
2
|
|
|
|
|
9
|
return $self->next::method(%args); |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=head2 submit |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
Queue a new job for processing. |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
Takes zero or more C => C arguments to be used as |
|
57
|
|
|
|
|
|
|
job parameters. |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
Returns a L instance. |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=cut |
|
62
|
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub submit { |
|
64
|
0
|
|
|
0
|
1
|
|
my ($self, %args) = @_; |
|
65
|
|
|
|
|
|
|
... |
|
66
|
0
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
1; |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 AUTHOR |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
Tom Molesworth |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
=head1 LICENSE |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
Copyright Tom Molesworth 2016-2017. Licensed under the same terms as Perl itself. |
|
77
|
|
|
|
|
|
|
|