line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package YARN::YarnClient; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
4
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
35
|
|
4
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
109
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
## Create a new instance of YarnClient |
7
|
|
|
|
|
|
|
sub createYarnClient { |
8
|
0
|
|
|
0
|
0
|
|
my ($self, $conf) = @_; |
9
|
|
|
|
|
|
|
|
10
|
0
|
|
|
|
|
|
return $self; |
11
|
|
|
|
|
|
|
} |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
## This method is a proxy for REST::Client |
14
|
|
|
|
|
|
|
sub connect { |
15
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
16
|
|
|
|
|
|
|
|
17
|
0
|
|
|
|
|
|
$self = REST::Client->new(); |
18
|
|
|
|
|
|
|
|
19
|
0
|
|
|
|
|
|
return $self; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
## Returns the URL of the API (example: yarn.example.com:8088/ws/v1/cluster/info) |
23
|
|
|
|
|
|
|
sub api_path { |
24
|
0
|
|
|
0
|
0
|
|
my ($self, $conf, $api) = @_; |
25
|
|
|
|
|
|
|
|
26
|
0
|
|
|
|
|
|
my $url = $conf->{host} . ":" . $conf->{port} . $conf->{endpoint} . "/" . $api; |
27
|
|
|
|
|
|
|
|
28
|
0
|
|
|
|
|
|
return $url; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
1; |