blib/lib/HPC/Runner/Command/execute_job/Base.pm

filter: Statementstmt 75.0% 21 / 28 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 17 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 57.1% 4 / 7 Podpod n/a totaltotal 40.9% 25 / 61 CC 8 SCAR 37.3
CC
8
Cov
45%
__ANON__
72.0
__ANON__
2.0
__ANON__
2.0
CRAP 41.7
« blib/lib/HPC/Runner/Command/stats.pm ↑ Summary blib/lib/HPC/Runner/Command/Logger/JSON/Archive.pm »
1 package HPC::Runner::Command::execute_job::Base;
2  
3 1 ▶use MooseX::App::Role;
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  
6 1 with 'HPC::Runner::Command::execute_job::Utils::Plugin';
7 1 with 'HPC::Runner::Command::execute_job::Utils::Log';
8 1 with 'HPC::Runner::Command::execute_job::Logger::JSON';
9  
10 1 ▶use Sys::Hostname;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Archive::Tar;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 =head2 Command Line Options
14  
15 =cut
16  
17  
18 =head2 Internal Attriutes
19  
20 =cut
21  
22 =head3 job_scheduler_id
23  
24 Job Scheduler ID running the script. Passed to slurm for mail information
25  
26 =cut
27  
28 has 'job_scheduler_id' => (
29 is => 'rw',
30 isa => 'Str|Undef',
31 default => sub {
32 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=8 SCAR=42.8
33 my $scheduler_id =
34 $ENV{SLURM_ARRAY_JOB_ID}
35 || $ENV{SLURM_JOB_ID}
36 || $ENV{SBATCH_JOB_ID}
37 || $ENV{PBS_JOBID}
38 || $ENV{JOB_ID}
39 0 ▶ || '';
Condition0%0/14
$ENV{'SLURM_ARRAY_JOB_ID'} || $ENV{'SLURM_JOB_ID'} || $ENV{'SBATCH_JOB_ID'} || $ENV{'PBS_JOBID'} || $ENV{'JOB_ID'} || ''
l!l
00
$ENV{"SLURM_ARRAY_JOB_ID"} or $ENV{"SLURM_JOB_ID"} or $ENV{"SBATCH_JOB_ID"} or $ENV{"PBS_JOBID"} or $ENV{"JOB_ID"}
l!l&&r!l&&!r
000
$ENV{"SLURM_ARRAY_JOB_ID"} or $ENV{"SLURM_JOB_ID"} or $ENV{"SBATCH_JOB_ID"} or $ENV{"PBS_JOBID"}
l!l&&r!l&&!r
000
$ENV{"SLURM_ARRAY_JOB_ID"} or $ENV{"SLURM_JOB_ID"} or $ENV{"SBATCH_JOB_ID"}
l!l&&r!l&&!r
000
$ENV{"SLURM_ARRAY_JOB_ID"} or $ENV{"SLURM_JOB_ID"}
l!l&&r!l&&!r
000
MC/DC0%0/5
$ENV{'SLURM_ARRAY_JOB_ID'} || $ENV{'SLURM_JOB_ID'} || $ENV{'SBATCH_JOB_ID'} || $ENV{'PBS_JOBID'} || $ENV{'JOB_ID'} || ''
$ENV{"SLURM_ARRAY_JOB_ID"} $ENV{"SLURM_JOB_ID"} $ENV{"SBATCH_JOB_ID"} $ENV{"PBS_JOBID"} $ENV{"JOB_ID"}
Truth table0%0/6
A or B or C or D or E
A= $ENV{"SLURM_ARRAY_JOB_ID"}B= $ENV{"SLURM_JOB_ID"}C= $ENV{"SBATCH_JOB_ID"}D= $ENV{"PBS_JOBID"}E= $ENV{"JOB_ID"}
ABCDEresult
1XXXX1
01XXX1
001XX1
0001X1
000011
000000
40 0 ▶ if ( $self->can('task_id') && $self->task_id ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("task_id") and $self->task_id) 0 0 0
Condition0%0/3
$self->can("task_id") and $self->task_id
!ll&&!rl&&r
000
MC/DC0%0/2
$self->can("task_id") and $self->task_id
$self->can("task_id") $self->task_id
Truth table0%0/3
A and B
A= $self->can("task_id")B= $self->task_id
ABresult
0X0
100
111
41 0 $scheduler_id = $scheduler_id . '_' . $self->task_id;
42 }
43 0 return $scheduler_id;
44 },
45 1 lazy => 1,
46 documentation =>
47 q{This defaults to your current Job Scheduler ID. Ignore this if running on a single node},
48 predicate => 'has_job_scheduler_id',
49 clearer => 'clear_job_scheduler_id',
50 );
51  
52 has 'hostname' => (
53 is => 'rw',
54 isa => 'Str|Undef',
55 default => sub {
56 0 ▶ return hostname;
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 },
58 1 );
59  
60 1 has 'wait' => (
61 is => 'rw',
62 isa => 'Bool',
63 default => 0,
64 );
65  
66 =head3 counter
67  
68 This is task_id counter. Batch index start and/or array_id get passed in on the command line
69 But for instances where we are creating a threadpool of more than 1 task
70 The counter keeps track
71  
72 =cut
73  
74 1 has 'counter' => (
75 traits => ['Counter'],
76 is => 'rw',
77 isa => 'Num',
78 required => 1,
79 default => 1,
80 handles => {
81 inc_counter => 'inc',
82 dec_counter => 'dec',
83 reset_counter => 'reset',
84 },
85 );
86  
87 has 'jobref' => (
88 is => 'rw',
89 isa => 'ArrayRef',
90 0 ▶ default => sub { [ [] ] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
91 1 );
92  
93 1 1;
« blib/lib/HPC/Runner/Command/stats.pm ↑ Summary blib/lib/HPC/Runner/Command/Logger/JSON/Archive.pm »