line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gearman::JobStatus; |
2
|
8
|
|
|
8
|
|
887
|
use version (); |
|
8
|
|
|
|
|
1302
|
|
|
8
|
|
|
|
|
258
|
|
3
|
|
|
|
|
|
|
$Gearman::JobStatus::VERSION = version->declare("2.003_001"); |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
26
|
use strict; |
|
8
|
|
|
|
|
10
|
|
|
8
|
|
|
|
|
123
|
|
7
|
8
|
|
|
8
|
|
25
|
use warnings; |
|
8
|
|
|
|
|
9
|
|
|
8
|
|
|
|
|
1225
|
|
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
|
4494
|
my ($class, $known, $running, $nu, $de) = @_; |
23
|
7
|
100
|
66
|
|
|
27
|
$nu = '' unless defined($nu) && length($nu); |
24
|
7
|
100
|
66
|
|
|
16
|
$de = '' unless defined($de) && length($de); |
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
18
|
return bless [$known, $running, $nu, $de], $class; |
27
|
|
|
|
|
|
|
} ## end sub new |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 known() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
1
|
604
|
sub known { shift->[0]; } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 running() |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
1
|
575
|
sub running { shift->[1]; } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 progress() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub progress { |
46
|
2
|
|
|
2
|
1
|
586
|
my $self = shift; |
47
|
2
|
100
|
|
|
|
9
|
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
|
1228
|
my $self = shift; |
56
|
3
|
100
|
66
|
|
|
20
|
return ($self->[2] ne '' && $self->[3]) |
57
|
|
|
|
|
|
|
? ($self->[2] / $self->[3]) |
58
|
|
|
|
|
|
|
: undef; |
59
|
|
|
|
|
|
|
} ## end sub percent |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |