| 1 | package HPC::Runner::Command::stats; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use MooseX::App::Command; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use Log::Log4perl qw(:easy); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use JSON; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use Text::ASCIITable; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 1 | with 'HPC::Runner::Command::Plugin::Logger::Sqlite'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 1 | command_short_description 'Get an overview of your submission.'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | 1 | command_long_description 'Query the sqlite database for a submission overview.'; | |||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | #TODO project and jobname are already defined as options in execute_array | ||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 1 | option 'project' => ( | |||||||||||||||||||||||||||||||||||||||||
| 16 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 17 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 18 | documentation => 'Query by project', | ||||||||||||||||||||||||||||||||||||||||||
| 19 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 20 | predicate => 'has_project', | ||||||||||||||||||||||||||||||||||||||||||
| 21 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 22 | |||||||||||||||||||||||||||||||||||||||||||
| 23 | 1 | option 'jobname' => ( | |||||||||||||||||||||||||||||||||||||||||
| 24 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 25 | isa => 'Str', | ||||||||||||||||||||||||||||||||||||||||||
| 26 | documentation => 'Query by jobname', | ||||||||||||||||||||||||||||||||||||||||||
| 27 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 28 | predicate => 'has_jobname', | ||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 1 | option 'summary' => ( | |||||||||||||||||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 33 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||
| 34 | documentation => | ||||||||||||||||||||||||||||||||||||||||||
| 35 | 'Summary view of your jobs - Number of running, completed, failed, successful.', | ||||||||||||||||||||||||||||||||||||||||||
| 36 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 37 | default => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 38 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||||||||||||
| 40 | option 'long' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 41 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 42 | isa => 'Bool', | ||||||||||||||||||||||||||||||||||||||||||
| 43 | documentation => | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 'Long view. More detailed report - Task tags, exit codes, duration, etc.', | ||||||||||||||||||||||||||||||||||||||||||
| 45 | required => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 46 | default => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 47 | trigger => sub { | ||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | $self->summary(0) if $self->long; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | }, | ||||||||||||||||||||||||||||||||||||||||||
| 51 | 1 | cmd_aliases => ['l'], | |||||||||||||||||||||||||||||||||||||||||
| 52 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||
| 54 | has 'task_data' => ( | ||||||||||||||||||||||||||||||||||||||||||
| 55 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||
| 56 | isa => 'HashRef', | ||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | ▶ | default => sub { {} }, | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | 1 | clearer => 'clear_task_data', | |||||||||||||||||||||||||||||||||||||||||
| 59 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||||||||
| 61 | sub execute { | ||||||||||||||||||||||||||||||||||||||||||
| 62 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||||||||||||||||
| 64 | 0 | ▶ | if ( $self->summary ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 65 | 0 | $self->summary_view; | |||||||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||||||||
| 67 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | $self->long_view; | |||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | } | ||||||||||||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||||||||||||
| 72 | sub long_view { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
long_view: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | my $results_pass = $self->build_query; | |||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | while ( my $res = $results_pass->next ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | my $table = $self->build_table($res); | |||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | $table->setCols( | |||||||||||||||||||||||||||||||||||||||||
| 81 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 82 | 'JobName', | ||||||||||||||||||||||||||||||||||||||||||
| 83 | 'Task Tags', | ||||||||||||||||||||||||||||||||||||||||||
| 84 | 'Start Time', | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 'End Time', | ||||||||||||||||||||||||||||||||||||||||||
| 86 | 'Duration', | ||||||||||||||||||||||||||||||||||||||||||
| 87 | 'Exit Code' | ||||||||||||||||||||||||||||||||||||||||||
| 88 | ] | ||||||||||||||||||||||||||||||||||||||||||
| 89 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||||||||||||
| 91 | 0 | map { $self->iter_jobs_long($_) } @{ $res->{jobs} }; | |||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | while ( my ( $k, $v ) = each %{ $self->task_data } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | foreach my $h ( @{$v} ) { | |||||||||||||||||||||||||||||||||||||||||
| 94 | $table->addRow( | ||||||||||||||||||||||||||||||||||||||||||
| 95 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 96 | $k, $h->{task_tags}, $h->{start_time}, | ||||||||||||||||||||||||||||||||||||||||||
| 97 | $h->{end_time}, $h->{duration}, $h->{exit_code} | ||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | ] | |||||||||||||||||||||||||||||||||||||||||
| 99 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | $table->addRowLine; | |||||||||||||||||||||||||||||||||||||||||
| 102 | } | ||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | $self->task_data( {} ); | |||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | print $table; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 106 | } | ||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | sub iter_jobs_long { | ||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iter_jobs_long: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my $job = shift; | |||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | ▶ | if ( !exists $self->task_data->{ $job->{job_name} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $self->task_data->{ $job->{job_name} } = []; | |||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | map { $self->iter_tasks_long( $job->{job_name}, $_ ) } @{ $job->{tasks} }; | |||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | sub iter_tasks_long { | ||||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iter_tasks_long: not called CC=6 SCAR=37.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $jobname = shift; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | my $task = shift; | |||||||||||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | my $exit_code = $task->{exit_code}; | |||||||||||||||||||||||||||||||||||||||||
| 126 | 0 | ▶ | $exit_code = "" if !defined $exit_code; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | push( | ||||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | @{ $self->task_data->{$jobname} }, | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/8
$task->{'start_time'} || ''
$task->{'exit_time'} || ''
$task->{'task_tags'} || ''
$task->{'duration'} || ''
MC/DC0%0/1
$task->{'start_time'} || ''
$task->{'start_time'}
MC/DC0%0/1
$task->{'exit_time'} || ''
$task->{'exit_time'}
MC/DC0%0/1
$task->{'task_tags'} || ''
$task->{'task_tags'}
MC/DC0%0/1
$task->{'duration'} || ''
$task->{'duration'}
Truth table0%0/2
A
A= $task->{'start_time'}
Truth table0%0/2
A
A= $task->{'exit_time'}
Truth table0%0/2
A
A= $task->{'task_tags'}
Truth table0%0/2
A
A= $task->{'duration'}
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | { | ||||||||||||||||||||||||||||||||||||||||||
| 131 | 'start_time' => $task->{start_time} || "", | ||||||||||||||||||||||||||||||||||||||||||
| 132 | 'end_time' => $task->{exit_time} || "", | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 'task_tags' => $task->{task_tags} || "", | ||||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | 'duration' => $task->{duration} || "", | |||||||||||||||||||||||||||||||||||||||||
| 135 | 'exit_code' => $exit_code, | ||||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | sub summary_view { | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
summary_view: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||
| 143 | 0 | my $results_pass = $self->build_query; | |||||||||||||||||||||||||||||||||||||||||
| 144 | |||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | ▶ | while ( my $res = $results_pass->next ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | my $table = $self->build_table($res); | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $table->setCols( | |||||||||||||||||||||||||||||||||||||||||
| 149 | [ 'JobName', 'Complete', 'Running', 'Success', 'Fail', 'Total' ] ); | ||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | map { $self->iter_jobs_summary($_) } @{ $res->{jobs} }; | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | while ( my ( $k, $v ) = each %{ $self->task_data } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | $table->addRow( | ||||||||||||||||||||||||||||||||||||||||||
| 155 | [ | ||||||||||||||||||||||||||||||||||||||||||
| 156 | $k, | ||||||||||||||||||||||||||||||||||||||||||
| 157 | $self->task_data->{$k}->{complete}, | ||||||||||||||||||||||||||||||||||||||||||
| 158 | $self->task_data->{$k}->{running}, | ||||||||||||||||||||||||||||||||||||||||||
| 159 | $self->task_data->{$k}->{success}, | ||||||||||||||||||||||||||||||||||||||||||
| 160 | $self->task_data->{$k}->{fail}, | ||||||||||||||||||||||||||||||||||||||||||
| 161 | $self->task_data->{$k}->{total}, | ||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ] | |||||||||||||||||||||||||||||||||||||||||
| 163 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->task_data( {} ); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | print $table; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | print "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 169 | } | ||||||||||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | sub build_table { | ||||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_table: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | my $res = shift; | |||||||||||||||||||||||||||||||||||||||||
| 175 | |||||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | my $header = "Time: " . $res->{submission_time}; | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | $header .= " SubmissionID: " . $res->{submission_pi}; | |||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | ▶ | $header .= " Project: " . $res->{project} if defined $res->{project}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $table = Text::ASCIITable->new( { headingText => $header } ); | |||||||||||||||||||||||||||||||||||||||||
| 180 | |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | return $table; | |||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||
| 183 | |||||||||||||||||||||||||||||||||||||||||||
| 184 | sub build_query { | ||||||||||||||||||||||||||||||||||||||||||
| 185 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build_query: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | # $self->schema->storage->debug(1); | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $where = {}; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | ▶ | if ( $self->has_project ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $where->{project} = $self->project; | |||||||||||||||||||||||||||||||||||||||||
| 191 | } | ||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if ( $self->has_jobname ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | $where->{'jobs.job_name'} = $self->jobname; | |||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | my $results_pass = $self->schema->resultset('Submission')->search( | |||||||||||||||||||||||||||||||||||||||||
| 197 | $where, | ||||||||||||||||||||||||||||||||||||||||||
| 198 | { | ||||||||||||||||||||||||||||||||||||||||||
| 199 | join => { jobs => 'tasks' }, | ||||||||||||||||||||||||||||||||||||||||||
| 200 | prefetch => { jobs => 'tasks' }, | ||||||||||||||||||||||||||||||||||||||||||
| 201 | group_by => [ 'project', ], | ||||||||||||||||||||||||||||||||||||||||||
| 202 | order_by => { '-desc' => 'submission_pi', }, | ||||||||||||||||||||||||||||||||||||||||||
| 203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 204 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 205 | |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $results_pass->result_class('DBIx::Class::ResultClass::HashRefInflator'); | |||||||||||||||||||||||||||||||||||||||||
| 207 | 0 | return $results_pass; | |||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||
| 209 | |||||||||||||||||||||||||||||||||||||||||||
| 210 | sub iter_jobs_summary { | ||||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iter_jobs_summary: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 212 | 0 | my $job = shift; | |||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | if ( !exists $self->task_data->{ $job->{job_name} } ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | my $job_meta = decode_json( $job->{jobs_meta} ); | |||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $total_tasks = $job_meta->{job_tasks}; | |||||||||||||||||||||||||||||||||||||||||
| 217 | $self->task_data->{ $job->{job_name} } = { | ||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | complete => 0, | |||||||||||||||||||||||||||||||||||||||||
| 219 | success => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 220 | fail => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 221 | total => $total_tasks, | ||||||||||||||||||||||||||||||||||||||||||
| 222 | running => 0 | ||||||||||||||||||||||||||||||||||||||||||
| 223 | }; | ||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | map { $self->iter_tasks_summary( $job->{job_name}, $_ ) } | |||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | @{ $job->{tasks} }; | |||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | } | ||||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | sub iter_tasks_summary { | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
iter_tasks_summary: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | 0 | my $job_name = shift; | |||||||||||||||||||||||||||||||||||||||||
| 234 | 0 | my $task = shift; | |||||||||||||||||||||||||||||||||||||||||
| 235 | |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | if ( $self->task_is_running($task) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | $self->task_data->{$job_name}->{running} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | $self->task_data->{$job_name}->{complete} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 241 | 0 | ▶ | if ( $self->task_is_success($task) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | $self->task_data->{$job_name}->{success} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 243 | } | ||||||||||||||||||||||||||||||||||||||||||
| 244 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | $self->task_data->{$job_name}->{fail} += 1; | |||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | } | ||||||||||||||||||||||||||||||||||||||||||
| 248 | } | ||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | sub task_is_running { | ||||||||||||||||||||||||||||||||||||||||||
| 251 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
task_is_running: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 252 | 0 | my $task = shift; | |||||||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||||||||
| 254 | 0 | ▶ | if ( !defined $task->{exit_code} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 256 | } | ||||||||||||||||||||||||||||||||||||||||||
| 257 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||||||||
| 262 | sub task_is_success { | ||||||||||||||||||||||||||||||||||||||||||
| 263 | 0 | ▶ | my $self = shift; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
task_is_success: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 264 | 0 | my $task = shift; | |||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | if ( $task->{exit_code} == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 268 | } | ||||||||||||||||||||||||||||||||||||||||||
| 269 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | return 0; | |||||||||||||||||||||||||||||||||||||||||
| 271 | } | ||||||||||||||||||||||||||||||||||||||||||
| 272 | } | ||||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 1 | 1; | |||||||||||||||||||||||||||||||||||||||||