« blib/lib/HPC/Runner/Command/stats/Logger/JSON/Summary.pm
↑ Summary
blib/lib/HPC/Runner/Command/execute_job.pm »
| 1 | package HPC::Runner::Command::submit_jobs::Utils::Log; | ||||||||||||
| 2 | |||||||||||||
| 3 | 1 | ▶ | use Moose::Role; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 1 | ▶ | use namespace::autoclean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 1 | with 'HPC::Runner::Command::Utils::Log'; | |||||||||||
| 6 | |||||||||||||
| 7 | 1 | ▶ | use Text::ASCIITable; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | 1 | ▶ | use File::Spec; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 9 | 1 | ▶ | use File::Slurp; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 1 | ▶ | use Log::Log4perl qw(:easy); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 11 | |||||||||||||
| 12 | sub print_table_schedule_info { | ||||||||||||
| 13 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
print_table_schedule_info: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 14 | 0 | my $t = Text::ASCIITable->new(); | |||||||||||
| 15 | |||||||||||||
| 16 | 0 | my @rows = (); | |||||||||||
| 17 | 0 | foreach my $job ( $self->all_schedules ) { | |||||||||||
| 18 | 0 | my $row = []; | |||||||||||
| 19 | 0 | my $ref = $self->graph_job_deps->{$job}; | |||||||||||
| 20 | |||||||||||||
| 21 | 0 | push( @$row, $job ); | |||||||||||
| 22 | |||||||||||||
| 23 | 0 | my $depstring = join( ", ", @{$ref} ); | |||||||||||
| 24 | 0 | push( @$row, $depstring ); | |||||||||||
| 25 | |||||||||||||
| 26 | 0 | my $count_cmd = $self->jobs->{$job}->cmd_counter; | |||||||||||
| 27 | 0 | push( @$row, $count_cmd ); | |||||||||||
| 28 | |||||||||||||
| 29 | 0 | my $mem = $self->jobs->{$job}->mem; | |||||||||||
| 30 | 0 | push( @$row, $mem ); | |||||||||||
| 31 | |||||||||||||
| 32 | 0 | my $cpus = $self->jobs->{$job}->cpus_per_task; | |||||||||||
| 33 | 0 | push( @$row, $cpus ); | |||||||||||
| 34 | |||||||||||||
| 35 | 0 | $self->assign_num_max_array($job); | |||||||||||
| 36 | 0 | my $array_count = $self->jobs->{$job}->{num_job_arrays}; | |||||||||||
| 37 | |||||||||||||
| 38 | 0 | push( @$row, $array_count ); | |||||||||||
| 39 | |||||||||||||
| 40 | 0 | push( @rows, $row ); | |||||||||||
| 41 | } | ||||||||||||
| 42 | |||||||||||||
| 43 | $t->setCols( | ||||||||||||
| 44 | 0 | [ "JobName", "Deps", "Task Count", "Mem", "Cpu", "Num Arrays" ] ); | |||||||||||
| 45 | 0 | map { $t->addRow($_) } @rows; | |||||||||||
| 46 | 0 | $self->app_log->info( | |||||||||||
| 47 | "Here is your tabular dependency list in submission order"); | ||||||||||||
| 48 | 0 | $self->app_log->info( "\n\n" . $t ); | |||||||||||
| 49 | } | ||||||||||||
| 50 | |||||||||||||
| 51 | =head3 summarize_jobs | ||||||||||||
| 52 | |||||||||||||
| 53 | =cut | ||||||||||||
| 54 | |||||||||||||
| 55 | #TODO Update this! | ||||||||||||
| 56 | |||||||||||||
| 57 | sub summarize_jobs { | ||||||||||||
| 58 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
summarize_jobs: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||
| 59 | |||||||||||||
| 60 | 0 | my $t = Text::ASCIITable->new(); | |||||||||||
| 61 | 0 | my $x = 0; | |||||||||||
| 62 | 0 | my @rows = (); | |||||||||||
| 63 | |||||||||||||
| 64 | #SIGHS | ||||||||||||
| 65 | #cmd_start is zero indexes | ||||||||||||
| 66 | #But batches are 1 indexes | ||||||||||||
| 67 | #WHY DO I DO THIS TO MYSELF | ||||||||||||
| 68 | 0 | foreach my $job ( $self->all_schedules ) { | |||||||||||
| 69 | |||||||||||||
| 70 | 0 | my $cmd_start = $self->jobs->{$job}->{cmd_start}; | |||||||||||
| 71 | 0 | my $commands_per_node = $self->jobs->{$job}->commands_per_node; | |||||||||||
| 72 | |||||||||||||
| 73 | 0 | ▶ | for ( my $x = 0 ; $x < $self->jobs->{$job}->{num_job_arrays} ; $x++ ) { | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 74 | 0 | my $row = []; | |||||||||||
| 75 | |||||||||||||
| 76 | 0 | ▶ | next unless $self->jobs->{$job}->batch_indexes->[$x]; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 77 | |||||||||||||
| 78 | 0 | my $batch_indexes = $self->jobs->{$job}->batch_indexes->[$x]; | |||||||||||
| 79 | |||||||||||||
| 80 | 0 | my $batch_index_start = $batch_indexes->{batch_index_start} - 1; | |||||||||||
| 81 | 0 | my $batch_index_end = $batch_indexes->{batch_index_end} - 1; | |||||||||||
| 82 | |||||||||||||
| 83 | my $start_array = | ||||||||||||
| 84 | $self->jobs->{$job}->batches->[$batch_index_start]->{cmd_start} + | ||||||||||||
| 85 | 0 | $cmd_start; | |||||||||||
| 86 | |||||||||||||
| 87 | my $end_array = | ||||||||||||
| 88 | $self->jobs->{$job}->batches->[$batch_index_end]->{cmd_start} + | ||||||||||||
| 89 | $cmd_start - 1 + | ||||||||||||
| 90 | 0 | $self->jobs->{$job}->commands_per_node; | |||||||||||
| 91 | |||||||||||||
| 92 | 0 | my $len = $end_array - $start_array + 1; | |||||||||||
| 93 | |||||||||||||
| 94 | 0 | push( @{$row}, $job ); | |||||||||||
| 95 | 0 | ▶ | push( @{$row}, $self->jobs->{$job}->scheduler_ids->[$x] || '0' ); | ||||||||||
|
Condition0%0/2
$self->jobs->{$job}->scheduler_ids->[$x] || '0'
MC/DC0%0/1
$self->jobs->{$job}->scheduler_ids->[$x] || '0'
$self->jobs->{$job}->scheduler_ids->[$x]
Truth table0%0/2
A
A= $self->jobs->{$job}->scheduler_ids->[$x]
| |||||||||||||
| 96 | 0 | push( @{$row}, "$start_array-$end_array" ); | |||||||||||
| 97 | 0 | push( @{$row}, $len ); | |||||||||||
| 98 | 0 | push( @rows, $row ); | |||||||||||
| 99 | } | ||||||||||||
| 100 | } | ||||||||||||
| 101 | |||||||||||||
| 102 | $t->setCols( | ||||||||||||
| 103 | 0 | [ "Job Name", "Scheduler ID", "Task Indices", "Total Tasks" ] ); | |||||||||||
| 104 | 0 | map { $t->addRow($_) } @rows; | |||||||||||
| 105 | 0 | $self->app_log->info("Job Summary"); | |||||||||||
| 106 | 0 | $self->app_log->info( "\n" . $t ); | |||||||||||
| 107 | |||||||||||||
| 108 | 0 | return \@rows; | |||||||||||
| 109 | } | ||||||||||||
| 110 | |||||||||||||
| 111 | sub write_job_project_table { | ||||||||||||
| 112 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
write_job_project_table: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||
| 113 | |||||||||||||
| 114 | 0 | my $job_file = File::Spec->catdir( $self->logdir, 'project_job_table.md' ); | |||||||||||
| 115 | 0 | write_file( $job_file, '| Job | Status | Notes |'."\n" ); | |||||||||||
| 116 | 0 | foreach my $job ( $self->all_schedules ) { | |||||||||||
| 117 | 0 | write_file($job_file, {append => 1}, '| '.$job.' | | |'."\n"); | |||||||||||
| 118 | } | ||||||||||||
| 119 | 0 | $self->app_log->info('Project table per job: '.$job_file); | |||||||||||
| 120 | } | ||||||||||||
| 121 | |||||||||||||
| 122 | sub write_task_project_table { | ||||||||||||
| 123 | 0 | ▶ | my $self = shift; | ||||||||||
|
Subroutine
write_task_project_table: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||
| 124 | |||||||||||||
| 125 | 0 | my $task_file = File::Spec->catdir( $self->logdir, 'project_task_table.md' ); | |||||||||||
| 126 | 0 | write_file( $task_file, '| Job | TaskID | Status | Notes |'."\n" ); | |||||||||||
| 127 | 0 | foreach my $job ( $self->all_schedules ) { | |||||||||||
| 128 | 0 | my $cmd_start = $self->jobs->{$job}->{cmd_start} + 1; | |||||||||||
| 129 | 0 | my $cmd_end = $self->jobs->{$job}->cmd_counter + $cmd_start - 1; | |||||||||||
| 130 | 0 | ▶ | for(my $x=$cmd_start; $x<=$cmd_end; $x++){ | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 131 | 0 | write_file($task_file, {append => 1}, '| '.$job.' | '.$x.' | | |'."\n"); | |||||||||||
| 132 | } | ||||||||||||
| 133 | } | ||||||||||||
| 134 | |||||||||||||
| 135 | 0 | $self->app_log->info('Project table per task: '.$task_file); | |||||||||||
| 136 | } | ||||||||||||
| 137 | |||||||||||||
| 138 | 1 | 1; | |||||||||||