line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Qless::BaseJob; |
2
|
1
|
|
|
1
|
|
5
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
27
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
24
|
|
3
|
1
|
|
|
1
|
|
5
|
use Qless::Utils qw(fix_empty_array); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
46
|
|
4
|
1
|
|
|
1
|
|
6
|
use Time::HiRes qw(); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
598
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
sub new { |
7
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
8
|
|
|
|
|
|
|
|
9
|
0
|
|
|
|
|
|
my ($client, $args) = @_; |
10
|
|
|
|
|
|
|
|
11
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
12
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
13
|
|
|
|
|
|
|
|
14
|
0
|
|
|
|
|
|
$self->{'client'} = $client; |
15
|
|
|
|
|
|
|
|
16
|
0
|
|
|
|
|
|
$self->{'_loaded'} = {}; |
17
|
0
|
|
|
|
|
|
foreach my $key (qw(data jid priority)) { |
18
|
0
|
|
|
|
|
|
$self->{$key} = $args->{ $key }; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
$self->{'klass'} = $args->{'klass'}; |
22
|
0
|
|
|
|
|
|
$self->{'queue_name'} = $args->{'queue'}; |
23
|
0
|
|
|
|
|
|
$self->{'tags'} = fix_empty_array($args->{'tags'}); |
24
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub priority { |
30
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
|
if ($#_ == 0) { |
33
|
0
|
|
|
|
|
|
$self->{'client'}->_priority([], $self->{'jid'}, $_[0]); |
34
|
0
|
|
|
|
|
|
$self->{'priority'} = $_[0]; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
|
return $self->{'priority'}; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub queue { |
41
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
42
|
0
|
|
|
|
|
|
return $self->{'queue'} = $self->{'client'}->queues($self->{'queue_name'}); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
0
|
|
|
0
|
0
|
|
sub client { $_[0]->{'client'} } |
46
|
0
|
|
|
0
|
0
|
|
sub queue_name { $_[0]->{'queue_name'} } |
47
|
0
|
|
|
0
|
0
|
|
sub klass { $_[0]->{'klass'} } |
48
|
0
|
|
|
0
|
0
|
|
sub data { $_[0]->{'data'} } |
49
|
0
|
|
|
0
|
0
|
|
sub jid { $_[0]->{'jid'} } |
50
|
0
|
|
|
0
|
0
|
|
sub tags { $_[0]->{'tags'} } |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub cancel { |
53
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
54
|
0
|
|
|
|
|
|
$self->{'client'}->_cancel([], $self->{'jid'}); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub tag { |
58
|
0
|
|
|
0
|
0
|
|
my ($self, @tags) = @_; |
59
|
0
|
|
|
|
|
|
$self->{'client'}->_tag([], 'add', $self->{'jid'}, Time::HiRes::time, @tags); |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub untag { |
63
|
0
|
|
|
0
|
0
|
|
my ($self, @tags) = @_; |
64
|
0
|
|
|
|
|
|
$self->{'client'}->_tag([], 'remove', $self->{'jid'}, Time::HiRes::time, @tags); |
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
68
|
|
|
|
|
|
|
|