line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gearman::JobStatus; |
2
|
8
|
|
|
8
|
|
1164
|
use version (); |
|
8
|
|
|
|
|
1395
|
|
|
8
|
|
|
|
|
273
|
|
3
|
|
|
|
|
|
|
$Gearman::JobStatus::VERSION = version->declare("2.003_002"); |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
25
|
use strict; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
137
|
|
7
|
8
|
|
|
8
|
|
23
|
use warnings; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
1266
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Gearman::JobStatus - represents a job status in gearman distributed job system |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 DESCRIPTION |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
L get_status($handle) returns I for a given handle |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 METHODS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=cut |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
7
|
|
|
7
|
0
|
3094
|
my ($class, $known, $running, $nu, $de) = @_; |
23
|
7
|
100
|
66
|
|
|
24
|
$nu = '' unless defined($nu) && length($nu); |
24
|
7
|
100
|
66
|
|
|
21
|
$de = '' unless defined($de) && length($de); |
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
17
|
return bless [$known, $running, $nu, $de], $class; |
27
|
|
|
|
|
|
|
} ## end sub new |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 known() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
1
|
491
|
sub known { shift->[0]; } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 running() |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
1
|
514
|
sub running { shift->[1]; } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 progress() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub progress { |
46
|
2
|
|
|
2
|
1
|
444
|
my $self = shift; |
47
|
2
|
100
|
|
|
|
8
|
return $self->[2] ne '' ? [$self->[2], $self->[3]] : undef; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 percent() |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
=cut |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub percent { |
55
|
3
|
|
|
3
|
1
|
947
|
my $self = shift; |
56
|
3
|
100
|
66
|
|
|
17
|
return ($self->[2] ne '' && $self->[3]) |
57
|
|
|
|
|
|
|
? ($self->[2] / $self->[3]) |
58
|
|
|
|
|
|
|
: undef; |
59
|
|
|
|
|
|
|
} ## end sub percent |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |