File Coverage

blib/lib/HPC/Runner/Command/submit_jobs/Utils/Scheduler/UseArrays.pm
Criterion Covered Total %
statement 3 26 11.5
branch n/a
condition n/a
subroutine 1 6 16.6
pod 0 5 0.0
total 4 37 10.8


line stmt bran cond sub pod time code
1             package HPC::Runner::Command::submit_jobs::Utils::Scheduler::UseArrays;
2              
3 1     1   5141 use Moose::Role;
  1         3  
  1         12  
4              
5             has 'subcommand' => (
6             is => 'rw',
7             isa => 'Str',
8             default => 'execute_array',
9             );
10              
11             has 'desc' => (
12             is => 'rw',
13             isa => 'Str',
14             default => 'tasks',
15             );
16              
17             sub build_task_deps {
18 0     0 0   my $self = shift;
19 0           my $batch_scheduler_id = shift;
20 0           my $dep_scheduler_id = shift;
21 0           my $batch_task_index = shift;
22 0           my $dep_task_index = shift;
23              
24 0           my $array_dep = [
25             $batch_scheduler_id . '_' . $batch_task_index,
26             $dep_scheduler_id . '_' . $dep_task_index,
27             ];
28              
29 0           return $array_dep;
30             }
31              
32             sub prepare_batch_indexes {
33 0     0 0   my $self = shift;
34              
35 0           return $self->jobs->{ $self->current_job }->batch_indexes;
36             }
37              
38             sub gen_batch_index_str {
39 0     0 0   my $self = shift;
40              
41 0           my $counter = $self->jobs->{ $self->current_job }->{cmd_start} + 1;
42 0           return "$counter";
43             }
44              
45             sub gen_array_str {
46 0     0 0   my $self = shift;
47 0           my $batch_indexes = shift;
48              
49 0           my $batch_index_start = $batch_indexes->{batch_index_start} - 1;
50 0           my $batch_index_end = $batch_indexes->{batch_index_end} - 1;
51              
52             my $start_array =
53             $self->jobs->{ $self->current_job }->{batches}->[$batch_index_start]
54 0           ->{cmd_start} + $self->jobs->{ $self->current_job }->{cmd_start};
55              
56             my $end_array =
57             $self->jobs->{ $self->current_job }->{batches}->[$batch_index_end]
58 0           ->{cmd_start} + $self->jobs->{ $self->current_job }->{cmd_start};
59              
60             my $array_str =
61             $start_array . "-"
62             . $end_array . ':'
63 0           . $self->jobs->{ $self->current_job }->commands_per_node;
64              
65 0           return $array_str;
66             }
67              
68             sub gen_counter_str {
69 0     0 0   my $self = shift;
70              
71 0           my ( $batch_counter, $job_counter ) = $self->prepare_counter;
72 0           return $job_counter;
73             }
74              
75             1;