blib/lib/HPC/Runner/Command/stats/Logger/JSON/Long/TableOutput.pm untested

filter: Statementstmt 0.0% 0 / 50 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 10 MC/DCmcdc n/a Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 74 CC 4 SCAR 18.3
CC
4
Cov
0%
iter_jobs_long
12.0
iter_tasks_long
6.0
BEGIN
2.0
CRAP 6.2
1 package HPC::Runner::Command::stats::Logger::JSON::Long::TableOutput;
2  
3 use Moose::Role;
4 use namespace::autoclean;
5  
6 with 'HPC::Runner::Command::stats::Logger::JSON::TableOutput';
7  
8 use JSON;
9 use Text::ASCIITable;
10  
11 sub iter_jobs_long {
12 my $self = shift;
13 my $submission = shift;
14 my $jobref = shift;
15  
16 my $submission_id = $submission->{uuid};
17 my $table = $self->build_table($submission, $submission_id);
18  
19 $table->setCols(
20 [
21 'Jobname',
22 'TaskID',
23 'Task Tags',
24 'Start Time',
25 'End Time',
26 'Duration',
27 'Exit Code'
28 ]
29 );
30  
31 foreach my $job ( @{$jobref} ) {
32 my $jobname = $job->{job};
33  
34 if ( $self->jobname ) {
35 next unless $self->jobname eq $jobname;
36 }
37 my $total_tasks = $job->{total_tasks};
38  
39 my $tasks = $self->get_tasks( $submission_id, $jobname );
40 $self->iter_tasks_long( $jobname, $tasks, $table );
41  
42 $self->task_data( {} );
43 }
44  
45 print $table;
46 print "\n";
47 }
48  
49 sub iter_tasks_long {
50 my $self = shift;
51 my $jobname = shift;
52 my $tasks = shift;
53 my $table = shift;
54  
55 foreach my $task ( @{$tasks} ) {
56  
57 my $task_tags = $task->{task_tags} || '';
58 my $start_time = $task->{start_time} || '';
59  
60 my $end_time = $task->{exit_time} || '';
61 my $duration = $task->{duration} || '';
62 my $exit_code = $task->{exit_code};
63 my $task_id = $task->{task_id} || '';
64  
65 if ( !defined $exit_code ) {
66 $exit_code = '';
67 }
68  
69 $table->addRow(
70 [
71 $jobname, $task_id, $task_tags, $start_time,
72 $end_time, $duration, $exit_code,
73 ]
74 );
75  
76 }
77 }
78  
79 1;