line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Roary::JobRunner::Role; |
2
|
|
|
|
|
|
|
$Bio::Roary::JobRunner::Role::VERSION = '3.11.0'; |
3
|
|
|
|
|
|
|
# ABSTRACT: A role to add job runner functionality |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
17
|
|
|
17
|
|
10723
|
use Moose::Role; |
|
17
|
|
|
|
|
62840
|
|
|
17
|
|
|
|
|
61
|
|
7
|
17
|
|
|
17
|
|
89924
|
use Log::Log4perl qw(:easy); |
|
17
|
|
|
|
|
531877
|
|
|
17
|
|
|
|
|
75
|
|
8
|
17
|
|
|
17
|
|
11439
|
use File::Spec; |
|
17
|
|
|
|
|
36
|
|
|
17
|
|
|
|
|
4788
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
has 'job_runner' => ( is => 'rw', isa => 'Str', default => 'Local' ); |
11
|
|
|
|
|
|
|
has '_job_runner_class' => ( is => 'ro', isa => 'Str', lazy => 1, builder => '_build__job_runner_class' ); |
12
|
|
|
|
|
|
|
has 'memory_in_mb' => ( is => 'rw', isa => 'Int', default => '200' ); |
13
|
|
|
|
|
|
|
has '_queue' => ( is => 'rw', isa => 'Str', default => 'normal' ); |
14
|
|
|
|
|
|
|
has 'dont_wait' => ( is => 'rw', isa => 'Bool', default => 0 ); |
15
|
|
|
|
|
|
|
has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 ); |
16
|
|
|
|
|
|
|
has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger'); |
17
|
|
|
|
|
|
|
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 ); |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub _build_logger |
20
|
|
|
|
|
|
|
{ |
21
|
14
|
|
|
14
|
|
38
|
my ($self) = @_; |
22
|
14
|
|
|
|
|
31
|
my $level = $ERROR; |
23
|
14
|
50
|
|
|
|
332
|
if($self->verbose) |
24
|
|
|
|
|
|
|
{ |
25
|
0
|
|
|
|
|
0
|
$level = $DEBUG; |
26
|
|
|
|
|
|
|
} |
27
|
14
|
|
|
|
|
141
|
Log::Log4perl->easy_init($level); |
28
|
14
|
|
|
|
|
44068
|
my $logger = get_logger(); |
29
|
14
|
|
|
|
|
1173
|
return $logger; |
30
|
|
|
|
|
|
|
} |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub _build__job_runner_class { |
33
|
37
|
|
|
37
|
|
88
|
my ($self) = @_; |
34
|
37
|
|
|
|
|
896
|
my $job_runner_class = "Bio::Roary::JobRunner::" . $self->job_runner; |
35
|
37
|
|
|
|
|
2531
|
eval "require $job_runner_class"; |
36
|
37
|
|
|
|
|
953
|
return $job_runner_class; |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
sub _find_exe { |
40
|
6
|
|
|
6
|
|
11
|
my($self,$executables) = @_; |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
# If there is an explicit full path passed in, just return. |
43
|
6
|
100
|
|
|
|
23
|
if($executables->[0] =~ m!/!) |
44
|
|
|
|
|
|
|
{ |
45
|
4
|
|
|
|
|
10
|
return $executables->[0]; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
2
|
|
|
|
|
35
|
for my $dir (File::Spec->path) { |
49
|
18
|
|
|
|
|
20
|
for my $exec (@{$executables}) |
|
18
|
|
|
|
|
20
|
|
50
|
|
|
|
|
|
|
{ |
51
|
36
|
|
|
|
|
163
|
my $exe = File::Spec->catfile($dir, $exec); |
52
|
36
|
50
|
|
|
|
275
|
return $exe if -x $exe; |
53
|
|
|
|
|
|
|
} |
54
|
|
|
|
|
|
|
} |
55
|
2
|
|
|
|
|
7
|
return $executables->[0]; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
1; |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
__END__ |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=pod |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=encoding UTF-8 |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=head1 NAME |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
Bio::Roary::JobRunner::Role - A role to add job runner functionality |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 VERSION |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
version 3.11.0 |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 SYNOPSIS |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
A role to add job runner functionality |
78
|
|
|
|
|
|
|
with 'Bio::Roary::JobRunner::Role'; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head1 AUTHOR |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
This is free software, licensed under: |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=cut |