line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Qless::Workers; |
2
|
|
|
|
|
|
|
=head1 NAME |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Qless::Workers |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=cut |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
4
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
20
|
|
9
|
1
|
|
|
1
|
|
4
|
use JSON::XS qw(decode_json); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
39
|
|
10
|
1
|
|
|
1
|
|
5
|
use Time::HiRes qw(); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
11
|
1
|
|
|
1
|
|
438
|
use Qless::Utils qw(fix_empty_array); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
214
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new { |
14
|
0
|
|
|
0
|
0
|
|
my $class = shift; |
15
|
0
|
|
|
|
|
|
my ($client) = @_; |
16
|
|
|
|
|
|
|
|
17
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
18
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
19
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
|
$self->{'client'} = $client; |
21
|
|
|
|
|
|
|
|
22
|
0
|
|
|
|
|
|
$self; |
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub counts { |
26
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
27
|
0
|
|
|
|
|
|
my $results = decode_json($self->{'client'}->_workers([], Time::HiRes::time)); |
28
|
0
|
|
|
|
|
|
$results = fix_empty_array($results); |
29
|
0
|
|
|
|
|
|
return $results; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub item { |
33
|
0
|
|
|
0
|
0
|
|
my ($self, $name) = @_; |
34
|
0
|
|
|
|
|
|
my $rv = decode_json($self->{'client'}->_workers([], Time::HiRes::time, $name)); |
35
|
0
|
|
|
|
|
|
$rv->{'jobs'} = fix_empty_array($rv->{'jobs'}); |
36
|
0
|
|
|
|
|
|
$rv->{'stalled'} = fix_empty_array($rv->{'stalled'}); |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
$rv; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
1; |