line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Gearman::JobStatus; |
2
|
8
|
|
|
8
|
|
1293
|
use version (); |
|
8
|
|
|
|
|
1861
|
|
|
8
|
|
|
|
|
341
|
|
3
|
|
|
|
|
|
|
$Gearman::JobStatus::VERSION = version->declare("2.002.001"); #TRIAL |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
8
|
|
|
8
|
|
36
|
use strict; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
170
|
|
7
|
8
|
|
|
8
|
|
37
|
use warnings; |
|
8
|
|
|
|
|
11
|
|
|
8
|
|
|
|
|
1842
|
|
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
|
5435
|
my ($class, $known, $running, $nu, $de) = @_; |
23
|
7
|
100
|
66
|
|
|
34
|
$nu = '' unless defined($nu) && length($nu); |
24
|
7
|
100
|
66
|
|
|
21
|
$de = '' unless defined($de) && length($de); |
25
|
|
|
|
|
|
|
|
26
|
7
|
|
|
|
|
21
|
return bless [$known, $running, $nu, $de], $class; |
27
|
|
|
|
|
|
|
} ## end sub new |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=head2 known() |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
=cut |
32
|
|
|
|
|
|
|
|
33
|
2
|
|
|
2
|
1
|
898
|
sub known { shift->[0]; } |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=head2 running() |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=cut |
38
|
|
|
|
|
|
|
|
39
|
2
|
|
|
2
|
1
|
764
|
sub running { shift->[1]; } |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
=head2 progress() |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
=cut |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub progress { |
46
|
2
|
|
|
2
|
1
|
771
|
my $self = shift; |
47
|
2
|
100
|
|
|
|
11
|
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
|
1716
|
my $self = shift; |
56
|
3
|
100
|
66
|
|
|
25
|
return ($self->[2] ne '' && $self->[3]) |
57
|
|
|
|
|
|
|
? ($self->[2] / $self->[3]) |
58
|
|
|
|
|
|
|
: undef; |
59
|
|
|
|
|
|
|
} ## end sub percent |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |