| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Beekeeper::Service::Supervisor; |
|
2
|
|
|
|
|
|
|
|
|
3
|
11
|
|
|
11
|
|
6931
|
use strict; |
|
|
11
|
|
|
|
|
32
|
|
|
|
11
|
|
|
|
|
361
|
|
|
4
|
11
|
|
|
11
|
|
64
|
use warnings; |
|
|
11
|
|
|
|
|
30
|
|
|
|
11
|
|
|
|
|
504
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.09'; |
|
7
|
|
|
|
|
|
|
|
|
8
|
11
|
|
|
11
|
|
67
|
use Beekeeper::Client; |
|
|
11
|
|
|
|
|
26
|
|
|
|
11
|
|
|
|
|
6205
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# Show errors from perspective of caller |
|
11
|
|
|
|
|
|
|
$Carp::Internal{(__PACKAGE__)}++; |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub restart_pool { |
|
15
|
0
|
|
|
0
|
0
|
0
|
my ($class, %args) = @_; |
|
16
|
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
0
|
my $client = Beekeeper::Client->instance; |
|
18
|
0
|
|
|
|
|
0
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
19
|
|
|
|
|
|
|
|
|
20
|
0
|
|
|
|
|
0
|
$client->send_notification( |
|
21
|
|
|
|
|
|
|
method => '_bkpr.supervisor.restart_pool', |
|
22
|
|
|
|
|
|
|
params => \%args, |
|
23
|
|
|
|
|
|
|
); |
|
24
|
|
|
|
|
|
|
} |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub restart_workers { |
|
27
|
0
|
|
|
0
|
0
|
0
|
my ($class, %args) = @_; |
|
28
|
|
|
|
|
|
|
|
|
29
|
0
|
|
|
|
|
0
|
my $client = Beekeeper::Client->instance; |
|
30
|
0
|
|
|
|
|
0
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
0
|
$client->send_notification( |
|
33
|
|
|
|
|
|
|
method => '_bkpr.supervisor.restart_workers', |
|
34
|
|
|
|
|
|
|
params => \%args, |
|
35
|
|
|
|
|
|
|
); |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub get_workers_status { |
|
39
|
1
|
|
|
1
|
1
|
90
|
my ($class, %args) = @_; |
|
40
|
|
|
|
|
|
|
|
|
41
|
1
|
|
|
|
|
39
|
my $client = Beekeeper::Client->instance; |
|
42
|
1
|
|
|
|
|
26
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
43
|
1
|
|
|
|
|
5
|
my $timeout = delete $args{'timeout'}; |
|
44
|
|
|
|
|
|
|
|
|
45
|
1
|
|
|
|
|
19
|
my $resp = $client->call_remote( |
|
46
|
|
|
|
|
|
|
method => '_bkpr.supervisor.get_workers_status', |
|
47
|
|
|
|
|
|
|
params => \%args, |
|
48
|
|
|
|
|
|
|
timeout => $timeout, |
|
49
|
|
|
|
|
|
|
); |
|
50
|
|
|
|
|
|
|
|
|
51
|
1
|
|
|
|
|
19
|
return $resp->result; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub get_workers_status_async { |
|
55
|
0
|
|
|
0
|
1
|
0
|
my ($class, %args) = @_; |
|
56
|
|
|
|
|
|
|
|
|
57
|
0
|
|
|
|
|
0
|
my $on_success = delete $args{'on_success'}; |
|
58
|
0
|
|
|
|
|
0
|
my $on_error = delete $args{'on_error'}; |
|
59
|
|
|
|
|
|
|
|
|
60
|
0
|
0
|
|
|
|
0
|
unless ($on_error) { |
|
61
|
0
|
|
|
|
|
0
|
my ($file, $line) = (caller)[1,2]; |
|
62
|
0
|
|
|
0
|
|
0
|
$on_error = sub { die $_[0]->message . " at $file line $line\n"; }; |
|
|
0
|
|
|
|
|
0
|
|
|
63
|
|
|
|
|
|
|
} |
|
64
|
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
my $client = Beekeeper::Client->instance; |
|
66
|
0
|
|
|
|
|
0
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
67
|
0
|
|
|
|
|
0
|
my $timeout = delete $args{'timeout'}; |
|
68
|
|
|
|
|
|
|
|
|
69
|
0
|
|
|
|
|
0
|
$client->call_remote_async( |
|
70
|
|
|
|
|
|
|
method => '_bkpr.supervisor.get_workers_status', |
|
71
|
|
|
|
|
|
|
params => \%args, |
|
72
|
|
|
|
|
|
|
timeout => $timeout, |
|
73
|
|
|
|
|
|
|
on_success => $on_success, |
|
74
|
|
|
|
|
|
|
on_error => $on_error, |
|
75
|
|
|
|
|
|
|
); |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub get_services_status { |
|
79
|
14
|
|
|
14
|
1
|
90124045
|
my ($class, %args) = @_; |
|
80
|
|
|
|
|
|
|
|
|
81
|
14
|
|
|
|
|
742
|
my $client = Beekeeper::Client->instance; |
|
82
|
14
|
|
|
|
|
320
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
83
|
14
|
|
|
|
|
74
|
my $timeout = delete $args{'timeout'}; |
|
84
|
|
|
|
|
|
|
|
|
85
|
14
|
|
|
|
|
311
|
my $resp = $client->call_remote( |
|
86
|
|
|
|
|
|
|
method => '_bkpr.supervisor.get_services_status', |
|
87
|
|
|
|
|
|
|
params => \%args, |
|
88
|
|
|
|
|
|
|
timeout => $timeout, |
|
89
|
|
|
|
|
|
|
); |
|
90
|
|
|
|
|
|
|
|
|
91
|
14
|
|
|
|
|
336
|
return $resp->result; |
|
92
|
|
|
|
|
|
|
} |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
sub get_services_status_async { |
|
95
|
0
|
|
|
0
|
1
|
|
my ($class, %args) = @_; |
|
96
|
|
|
|
|
|
|
|
|
97
|
0
|
|
|
|
|
|
my $on_success = delete $args{'on_success'}; |
|
98
|
0
|
|
|
|
|
|
my $on_error = delete $args{'on_error'}; |
|
99
|
|
|
|
|
|
|
|
|
100
|
0
|
0
|
|
|
|
|
unless ($on_error) { |
|
101
|
0
|
|
|
|
|
|
my ($file, $line) = (caller)[1,2]; |
|
102
|
0
|
|
|
0
|
|
|
$on_error = sub { die $_[0]->message . " at $file line $line\n"; }; |
|
|
0
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
} |
|
104
|
|
|
|
|
|
|
|
|
105
|
0
|
|
|
|
|
|
my $client = Beekeeper::Client->instance; |
|
106
|
0
|
|
|
|
|
|
my $guard = $client->__use_authorization_token('BKPR_ADMIN'); |
|
107
|
0
|
|
|
|
|
|
my $timeout = delete $args{'timeout'}; |
|
108
|
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
$client->call_remote_async( |
|
110
|
|
|
|
|
|
|
method => '_bkpr.supervisor.get_services_status', |
|
111
|
|
|
|
|
|
|
params => \%args, |
|
112
|
|
|
|
|
|
|
timeout => $timeout, |
|
113
|
|
|
|
|
|
|
on_success => $on_success, |
|
114
|
|
|
|
|
|
|
on_error => $on_error, |
|
115
|
|
|
|
|
|
|
); |
|
116
|
|
|
|
|
|
|
} |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
1; |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
__END__ |