line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Bio::Roary::JobRunner::Local; |
2
|
|
|
|
|
|
|
$Bio::Roary::JobRunner::Local::VERSION = '3.10.1'; |
3
|
|
|
|
|
|
|
# ABSTRACT: Execute a set of commands locally |
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
|
6
|
13
|
|
|
13
|
|
89
|
use Moose; |
|
13
|
|
|
|
|
24
|
|
|
13
|
|
|
|
|
214
|
|
7
|
13
|
|
|
13
|
|
100540
|
use Log::Log4perl qw(:easy); |
|
13
|
|
|
|
|
34
|
|
|
13
|
|
|
|
|
124
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
has 'commands_to_run' => ( is => 'ro', isa => 'ArrayRef', required => 1 ); |
10
|
|
|
|
|
|
|
has 'logger' => ( is => 'ro', lazy => 1, builder => '_build_logger'); |
11
|
|
|
|
|
|
|
has 'verbose' => ( is => 'rw', isa => 'Bool', default => 0 ); |
12
|
|
|
|
|
|
|
has 'memory_in_mb' => ( is => 'rw', isa => 'Int', default => '200' ); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub run { |
15
|
37
|
|
|
37
|
0
|
108
|
my ($self) = @_; |
16
|
|
|
|
|
|
|
|
17
|
37
|
|
|
|
|
68
|
for my $command_to_run ( @{ $self->commands_to_run } ) { |
|
37
|
|
|
|
|
1148
|
|
18
|
34
|
|
|
|
|
2755
|
$self->logger->info($command_to_run); |
19
|
34
|
|
|
|
|
12124597
|
system($command_to_run ); |
20
|
|
|
|
|
|
|
} |
21
|
37
|
|
|
|
|
848
|
1; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub _construct_dependancy_params |
26
|
|
|
|
|
|
|
{ |
27
|
0
|
|
|
0
|
|
0
|
my ($self) = @_; |
28
|
0
|
|
|
|
|
0
|
return ''; |
29
|
|
|
|
|
|
|
} |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub submit_dependancy_job { |
32
|
0
|
|
|
0
|
0
|
0
|
my ( $self,$command_to_run) = @_; |
33
|
0
|
|
|
|
|
0
|
$self->logger->info($command_to_run); |
34
|
0
|
|
|
|
|
0
|
system($command_to_run ); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _build_logger |
38
|
|
|
|
|
|
|
{ |
39
|
21
|
|
|
21
|
|
63
|
my ($self) = @_; |
40
|
21
|
|
|
|
|
47
|
my $level = $ERROR; |
41
|
21
|
50
|
|
|
|
586
|
if($self->verbose) |
42
|
|
|
|
|
|
|
{ |
43
|
0
|
|
|
|
|
0
|
$level = $DEBUG; |
44
|
|
|
|
|
|
|
} |
45
|
21
|
|
|
|
|
241
|
Log::Log4perl->easy_init($level); |
46
|
21
|
|
|
|
|
99152
|
my $logger = get_logger(); |
47
|
21
|
|
|
|
|
2242
|
return $logger; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
13
|
|
|
13
|
|
15570
|
no Moose; |
|
13
|
|
|
|
|
39
|
|
|
13
|
|
|
|
|
77
|
|
51
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=pod |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=encoding UTF-8 |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head1 NAME |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
Bio::Roary::JobRunner::Local - Execute a set of commands locally |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head1 VERSION |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
version 3.10.1 |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head1 SYNOPSIS |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Execute a set of commands locally |
72
|
|
|
|
|
|
|
use Bio::Roary::JobRunner::Local; |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
my $obj = Bio::Roary::JobRunner::Local->new( |
75
|
|
|
|
|
|
|
commands_to_run => ['ls', 'echo "abc"'], |
76
|
|
|
|
|
|
|
); |
77
|
|
|
|
|
|
|
$obj->run(); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 AUTHOR |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
Andrew J. Page <ap13@sanger.ac.uk> |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
This software is Copyright (c) 2013 by Wellcome Trust Sanger Institute. |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
This is free software, licensed under: |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
The GNU General Public License, Version 3, June 2007 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=cut |