File Coverage

blib/lib/Net/Hadoop/YARN/ApplicationMaster.pm
Criterion Covered Total %
statement 11 19 57.8
branch n/a
condition n/a
subroutine 4 7 57.1
pod n/a
total 15 26 57.6


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