lib/Bio/Roary/JobRunner/Role.pm

filter: Statementstmt 97.4% 38 / 39 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod n/a totaltotal 94.1% 48 / 51 CC 6 SCAR 11.0
CC
6
Cov
93%
_find_exe
5.0
_build_logger
2.0
BEGIN
1.0
CRAP 3.0
« lib/Bio/Roary/PresenceAbsenceMatrix.pm ↑ Summary lib/Bio/Roary/ReorderSpreadsheet.pm »
1 package Bio::Roary::JobRunner::Role;
2 37 $Bio::Roary::JobRunner::Role::VERSION = '3.13.0';
3 # ABSTRACT: A role to add job runner functionality
4  
5  
6 37 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 37 ▶use Log::Log4perl qw(:easy);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 37 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 37 has 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' );
11 37 has '_job_runner_class' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__job_runner_class' );
12 37 has 'memory_in_mb' => ( is => 'rw', isa => 'Int', default => '200' );
13 37 has '_queue' => ( is => 'rw', isa => 'Str', default => 'normal' );
14 37 has 'dont_wait' => ( is => 'rw', isa => 'Bool', default => 0 );
15 37 has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
16 37 has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger');
17 37 has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 );
18  
19 sub _build_logger
20 34 ▶{
Subroutine _build_logger: called CC=2 SCAR=7.1
21 34 my ($self) = @_;
22 34 my $level = $ERROR;
23 34 ▶ if($self->verbose)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->verbose) 0 34 34
24 {
25 0 $level = $DEBUG;
26 }
27 34 Log::Log4perl->easy_init($level);
28 34 my $logger = get_logger();
29 34 return $logger;
30 }
31  
32 37 ▶sub _build__job_runner_class {
Subroutine _build__job_runner_class: called CC=1 SCAR=0.0
33 37 my ($self) = @_;
34 37 my $job_runner_class = "Bio::Roary::JobRunner::" . $self->job_runner;
35 37 eval "require $job_runner_class";
36 37 return $job_runner_class;
37 }
38  
39 6 ▶sub _find_exe {
Subroutine _find_exe: called CC=5 SCAR=16.1
40 6 my($self,$executables) = @_;
41
42 # If there is an explicit full path passed in, just return.
43 6 ▶ if($executables->[0] =~ m!/!)
Branch: 1 branch
BranchTrueFalseTotal
if ($executables->[0] =~ m[/]) 4 2 6
44 {
45 4 return $executables->[0];
46 }
47
48 2 for my $dir (File::Spec->path) {
49 20 for my $exec (@{$executables})
50 {
51 40 my $exe = File::Spec->catfile($dir, $exec);
52 40 ▶ return $exe if -x $exe;
Branch: 1 branch
BranchTrueFalseTotal
if -x $exe 0 40 40
53 }
54 }
55 2 return $executables->[0];
56 }
57  
58  
59 37 1;
60  
61 __END__
« lib/Bio/Roary/PresenceAbsenceMatrix.pm ↑ Summary lib/Bio/Roary/ReorderSpreadsheet.pm »