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