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.201';
3 1     1   20402 use strict;
  1         2  
  1         24  
4 1     1   4 use warnings;
  1         1  
  1         21  
5 1     1   10 use 5.10.0;
  1         2  
6 1     1   476 use Moo;
  1         9614  
  1         3  
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              
40             sub info {
41 0     0     my $self = shift;
42 0           my $res = $self->_get("info");
43 0           return $res->{info};
44             }
45              
46              
47             sub jobs {
48 0     0     my $self = shift;
49 0           $self->_get_jobs(@_);
50             }
51              
52              
53             sub tasks {
54 0     0     my $self = shift;
55 0           $self->_get_tasks(@_);
56             }
57              
58             sub taskattempt {
59 0     0     my $self = shift;
60 0           my $attempt = $self->_get_taskattempt(@_);
61             }
62              
63             1;
64              
65             __END__