| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Qless::ClientJobs; |
|
2
|
|
|
|
|
|
|
=head1 NAME |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
Qless::ClientJobs |
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=cut |
|
7
|
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
5
|
use strict; use warnings; |
|
|
1
|
|
|
1
|
|
2
|
|
|
|
1
|
|
|
|
|
40
|
|
|
|
1
|
|
|
|
|
4
|
|
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
24
|
|
|
9
|
1
|
|
|
1
|
|
5
|
use JSON::XS qw(decode_json encode_json); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
38
|
|
|
10
|
1
|
|
|
1
|
|
4
|
use Qless::Job; |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
19
|
|
|
11
|
1
|
|
|
1
|
|
457
|
use Qless::RecurringJob; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
21
|
|
|
12
|
1
|
|
|
1
|
|
6
|
use Qless::Utils qw(fix_empty_array); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
493
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 METHODS |
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head2 C |
|
17
|
|
|
|
|
|
|
=cut |
|
18
|
|
|
|
|
|
|
sub new { |
|
19
|
0
|
|
|
0
|
1
|
|
my $class = shift; |
|
20
|
0
|
|
|
|
|
|
my ($client) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
0
|
0
|
|
|
|
|
$class = ref $class if ref $class; |
|
23
|
0
|
|
|
|
|
|
my $self = bless {}, $class; |
|
24
|
|
|
|
|
|
|
|
|
25
|
0
|
|
|
|
|
|
$self->{'client'} = $client; |
|
26
|
|
|
|
|
|
|
|
|
27
|
0
|
|
|
|
|
|
$self; |
|
28
|
|
|
|
|
|
|
} |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head2 C |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
Return the paginated jids of complete jobs |
|
33
|
|
|
|
|
|
|
=cut |
|
34
|
|
|
|
|
|
|
sub complete { |
|
35
|
0
|
|
|
0
|
1
|
|
my ($self, $offset, $count) = @_; |
|
36
|
0
|
|
0
|
|
|
|
return $self->{'client'}->_jobs([], 'complete', $offset||0, $count||25); |
|
|
|
|
0
|
|
|
|
|
|
37
|
|
|
|
|
|
|
} |
|
38
|
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
=head2 C |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Return an array of job objects that are being tracked |
|
42
|
|
|
|
|
|
|
=cut |
|
43
|
|
|
|
|
|
|
sub tracked { |
|
44
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
|
45
|
0
|
|
|
|
|
|
my $results = decode_json($self->{'client'}->_track()); |
|
46
|
0
|
|
|
|
|
|
$results->{'jobs'} = fix_empty_array($results->{'jobs'}); |
|
47
|
0
|
|
|
|
|
|
$results->{'jobs'} = [ map { Qless::Job->new($self, $_) } @{ $results->{'jobs'} } ]; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
|
return $results; |
|
49
|
|
|
|
|
|
|
} |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=head2 C |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Return the paginated jids of jobs tagged with a tag |
|
54
|
|
|
|
|
|
|
=cut |
|
55
|
|
|
|
|
|
|
sub tagged { |
|
56
|
0
|
|
|
0
|
1
|
|
my ($self, $tag, $offset, $count) = @_; |
|
57
|
0
|
|
0
|
|
|
|
my $results = decode_json($self->{'client'}->_tag([], 'get', $tag, $offset||0, $count||25)); |
|
|
|
|
0
|
|
|
|
|
|
58
|
0
|
|
|
|
|
|
$results->{'jobs'} = fix_empty_array($results->{'jobs'}); |
|
59
|
0
|
|
|
|
|
|
return $results; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
=head2 C |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
If no group is provided, this returns a JSON blob of the counts of the various types of failures known. |
|
65
|
|
|
|
|
|
|
If a type is provided, returns paginated job objects affected by that kind of failure. |
|
66
|
|
|
|
|
|
|
=cut |
|
67
|
|
|
|
|
|
|
sub failed { |
|
68
|
0
|
|
|
0
|
1
|
|
my ($self, $group, $offset, $count) = @_; |
|
69
|
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
|
my $results; |
|
71
|
0
|
0
|
|
|
|
|
if (!$group) { |
|
72
|
0
|
|
|
|
|
|
$results = decode_json($self->{'client'}->_failed()); |
|
73
|
0
|
|
|
|
|
|
return $results; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
0
|
|
0
|
|
|
|
$results = decode_json($self->{'client'}->_failed([], $group, $offset||0, $count||25)); |
|
|
|
|
0
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
$results->{'jobs'} = fix_empty_array($results->{'jobs'}); |
|
78
|
0
|
|
|
|
|
|
$results->{'jobs'} = [ map { Qless::Job->new($self->{'client'}, $_) } @{ $results->{'jobs'} } ]; |
|
|
0
|
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
79
|
0
|
|
|
|
|
|
return $results; |
|
80
|
|
|
|
|
|
|
} |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=head2 C-
|
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
Get a job object corresponding to that jid, or C if it doesn't exist |
|
85
|
|
|
|
|
|
|
=cut |
|
86
|
|
|
|
|
|
|
sub item { |
|
87
|
0
|
|
|
0
|
1
|
|
my ($self, $jid) = @_; |
|
88
|
|
|
|
|
|
|
|
|
89
|
0
|
|
|
|
|
|
my $results = $self->{'client'}->_get([], $jid); |
|
90
|
0
|
0
|
|
|
|
|
if (!$results) { |
|
91
|
0
|
|
|
|
|
|
$results = $self->{'client'}->_recur([], 'get', $jid); |
|
92
|
0
|
0
|
|
|
|
|
return undef if !$results; |
|
93
|
|
|
|
|
|
|
|
|
94
|
0
|
|
|
|
|
|
return Qless::RecurringJob->new($self->{'client'}, decode_json($results)); |
|
95
|
|
|
|
|
|
|
} |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
return Qless::Job->new($self->{'client'}, decode_json($results)); |
|
98
|
|
|
|
|
|
|
} |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |