blib/lib/HPC/Runner/Command/execute_array.pm

filter: Statementstmt 68.5% 24 / 35 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 14 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 50.0% 4 / 8 Podpod n/a totaltotal 43.0% 28 / 65 CC 7 SCAR 26.2
CC
7
Cov
47%
__ANON__
30.0
__ANON__
12.0
execute
2.0
CRAP 13.8
« blib/lib/HPC/Runner/Command/submit_jobs/Plugin/PBS.pm ↑ Summary blib/lib/HPC/Runner/Command/stats/Logger/JSON/Summary.pm »
1 package HPC::Runner::Command::execute_array;
2  
3 1 ▶use MooseX::App::Command;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use MooseX::Types::Path::Tiny qw/Path Paths AbsPath AbsFile/;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use JSON::XS;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Try::Tiny;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 extends 'HPC::Runner::Command';
9  
10 1 with 'HPC::Runner::Command::Logger::JSON';
11 1 with 'HPC::Runner::Command::Utils::Base';
12 1 with 'HPC::Runner::Command::Utils::Log';
13 1 with 'HPC::Runner::Command::Utils::Git';
14 1 with 'HPC::Runner::Command::execute_job::Utils::MCE';
15  
16 1 command_short_description 'Execute commands';
17 1 command_long_description
18 'Take the parsed files from hpcrunner.pl submit_jobs and executes the code';
19  
20 1 option 'batch_index_start' => (
21 is => 'rw',
22 isa => 'Num',
23 required => 1,
24 predicate => 'has_batch_index_start',
25 documentation => 'Counter to tell execute_array where to start reading in the infile'
26 );
27  
28 ## For the scheduler we get this from the environment
29 has 'task_id' => (
30 is => 'rw',
31 default => sub {
32 return
33 $ENV{'SLURM_ARRAY_TASK_ID'}
34 || $ENV{'SBATCH_ARRAY_TASK_ID'}
35 || $ENV{'PBS_ARRAYID'}
36 0 ▶ || $ENV{'SGE_TASK_ID'}
Subroutine __ANON__: not called CC=5 SCAR=34.0
Condition0%0/11
$ENV{'SLURM_ARRAY_TASK_ID'} || $ENV{'SBATCH_ARRAY_TASK_ID'} || $ENV{'PBS_ARRAYID'} || $ENV{'SGE_TASK_ID'} || 0
l!l
00
$ENV{"SLURM_ARRAY_TASK_ID"} or $ENV{"SBATCH_ARRAY_TASK_ID"} or $ENV{"PBS_ARRAYID"} or $ENV{"SGE_TASK_ID"}
l!l&&r!l&&!r
000
$ENV{"SLURM_ARRAY_TASK_ID"} or $ENV{"SBATCH_ARRAY_TASK_ID"} or $ENV{"PBS_ARRAYID"}
l!l&&r!l&&!r
000
$ENV{"SLURM_ARRAY_TASK_ID"} or $ENV{"SBATCH_ARRAY_TASK_ID"}
l!l&&r!l&&!r
000
MC/DC0%0/4
$ENV{'SLURM_ARRAY_TASK_ID'} || $ENV{'SBATCH_ARRAY_TASK_ID'} || $ENV{'PBS_ARRAYID'} || $ENV{'SGE_TASK_ID'} || 0
$ENV{"SLURM_ARRAY_TASK_ID"} $ENV{"SBATCH_ARRAY_TASK_ID"} $ENV{"PBS_ARRAYID"} $ENV{"SGE_TASK_ID"}
Truth table0%0/5
A or B or C or D
A= $ENV{"SLURM_ARRAY_TASK_ID"}B= $ENV{"SBATCH_ARRAY_TASK_ID"}C= $ENV{"PBS_ARRAYID"}D= $ENV{"SGE_TASK_ID"}
ABCDresult
1XXX1
01XX1
001X1
00011
00000
37 || 0;
38 },
39 1 required => 0,
40 );
41  
42 ▶sub BUILD { }
Subroutine BUILD: not called CC=1 SCAR=0.0
43  
44 after 'BUILD' => sub {
45 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=3 SCAR=24.8
46  
47 0 ▶ if ( !$self->task_id && !$self->infile ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->task_id or $self->infile) 0 0 0
Condition0%0/3
$self->task_id or $self->infile
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->task_id or $self->infile
$self->task_id $self->infile
Truth table0%0/3
A or B
A= $self->task_idB= $self->infile
ABresult
1X1
011
000
48 0 $self->app_log->fatal(
49 'There is no infile and this does not seem to be an array job. Aborting mission!'
50 );
51 0 exit 1;
52 }
53  
54  
55 # $self->get_infile;
56 ##The Task ID is the initial value for the job array that is caught by an environmental variable
57 ##Once we get it we use the counter for both execute_job and execute_array
58 ##Except for the read_command, which uses the task_id
59 0 $self->counter( $self->task_id );
60  
61 0 $self->gen_load_plugins;
62 0 $self->job_load_plugins;
63  
64 # my $tar = $self->set_archive;
65 # $self->archive($tar);
66 1 };
67  
68 sub execute {
69 0 ▶ my $self = shift;
Subroutine execute: not called CC=1 SCAR=6.9
70  
71 0 $self->git_things;
72 0 $self->run_mce;
73 }
74  
75 1 1;
« blib/lib/HPC/Runner/Command/submit_jobs/Plugin/PBS.pm ↑ Summary blib/lib/HPC/Runner/Command/stats/Logger/JSON/Summary.pm »