File Coverage

blib/lib/Net/Hadoop/YARN/HistoryServer.pm
Criterion Covered Total %
statement 11 20 55.0
branch n/a
condition n/a
subroutine 4 8 50.0
pod n/a
total 15 28 53.5


line stmt bran cond sub pod time code
1             package Net::Hadoop::YARN::HistoryServer;
2             $Net::Hadoop::YARN::HistoryServer::VERSION = '0.202';
3 1     1   40989 use strict;
  1         2  
  1         43  
4 1     1   8 use warnings;
  1         2  
  1         43  
5 1     1   18 use 5.10.0;
  1         3  
6 1     1   801 use Moo;
  1         19512  
  1         7  
7              
8             with 'Net::Hadoop::YARN::Roles::AppMasterHistoryServer';
9             with 'Net::Hadoop::YARN::Roles::Common';
10              
11             #<<<
12             my $methods_urls = {
13             _get_jobs => ['/ws/v1/history/mapreduce/jobs', 'job' ],
14             job => ['/ws/v1/history/mapreduce/jobs/{jobid}', '' ],
15             jobconf => ['/ws/v1/history/mapreduce/jobs/{jobid}/conf', '' ],
16             jobcounters => ['/ws/v1/history/mapreduce/jobs/{jobid}/counters', 'counterGroup' ],
17             jobattempts => ['/ws/v1/history/mapreduce/jobs/{jobid}/jobattempts', 'jobAttempt' ],
18             _get_tasks => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks', 'task' ],
19             task => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}', '' ],
20             taskcounters => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/counters', 'taskCounterGroup' ],
21             taskattempts => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts', 'taskAttempt' ],
22             _get_taskattempt => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts/{attemptid}', '' ],
23             taskattemptcounters => ['/ws/v1/history/mapreduce/jobs/{jobid}/tasks/{taskid}/attempts/{attemptid}/counters', 'taskAttemptCounterGroup' ],
24             };
25             #>>>
26              
27             # For each of the keys:
28             # - make a method, adding the path
29             # - pass the path and variables to a validation and substitution engine
30             # - execute the request
31             # - return the proper fragment of the JSON tree
32              
33             _mk_subs($methods_urls);
34              
35             has '+servers' => (
36             default => sub { ["localhost:19888"] }, # same as resource manager by default
37             );
38              
39             sub info {
40 0     0     my $self = shift;
41 0           my $res = $self->_get("info");
42 0           return $res->{info};
43             }
44              
45             sub jobs {
46 0     0     my $self = shift;
47 0           $self->_get_jobs(@_);
48             }
49              
50             sub tasks {
51 0     0     my $self = shift;
52 0           $self->_get_tasks(@_);
53             }
54              
55             sub taskattempt {
56 0     0     my $self = shift;
57 0           my $attempt = $self->_get_taskattempt(@_);
58             }
59              
60             1;
61              
62             __END__