Codebase list roary / 136040f
Imported Upstream version 3.6.3+dfsg Sascha Steinbiss 7 years ago
5 changed file(s) with 14 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
00 name = Bio-Roary
1 version = 3.6.2
1 version = 3.6.3
22 author = Andrew J. Page <ap13@sanger.ac.uk>
33 license = GPL_3
44 copyright_holder = Wellcome Trust Sanger Institute
145145 }
146146 else
147147 {
148 $job_runner_to_use = 'Local';
148 $job_runner_to_use = 'Parallel';
149149 }
150150
151151 my $output_gene_files = $self->_find_input_files;
3030 has 'dont_delete_files' => ( is => 'rw', isa => 'Bool', default => 0 );
3131 has 'num_input_files' => ( is => 'ro', isa => 'Int', required => 1);
3232
33 # Overload Role
33 # Overload Role`
3434 has 'memory_in_mb' => ( is => 'rw', isa => 'Int', lazy => 1, builder => '_build_memory_in_mb' );
3535 has '_min_memory_in_mb' => ( is => 'ro', isa => 'Int', default => 1500 );
3636 has '_max_memory_in_mb' => ( is => 'ro', isa => 'Int', default => 60000 );
4242 sub _build__files_per_chunk
4343 {
4444 my ($self) = @_;
45 if($self->num_input_files > 1000)
46 {
47 return 5;
48 }
49 elsif($self->num_input_files > 500)
50 {
51 return 7;
52 }
53 return 10;
45 return 1;
5446 }
5547
5648 sub _build_memory_in_mb {
1717 use Moose;
1818 use File::Temp qw/ tempfile /;
1919 use Log::Log4perl qw(:easy);
20 use File::Slurper 'write_text';
21 use File::Temp qw/ tempfile /;
2022
2123 has 'commands_to_run' => ( is => 'ro', isa => 'ArrayRef', required => 1 );
2224 has 'cpus' => ( is => 'ro', isa => 'Int', default => 1 );
2729 sub run {
2830 my ($self) = @_;
2931
32 my($fh, $temp_command_filename) = tempfile();
33 write_text($temp_command_filename, join("\n", @{ $self->commands_to_run }) );
34
3035 for my $command_to_run(@{ $self->commands_to_run })
3136 {
3237 $self->logger->info($command_to_run);
3338 }
34 open(my $fh,"|-","parallel --gnu -j ".$self->cpus) || die "GNU Parallel failed";
35 print $fh join("\n", @{ $self->commands_to_run });
36 close $fh;
39 my $parallel_command = "parallel --gnu -j ".$self->cpus." < ".$temp_command_filename ;
40 $self->logger->info($parallel_command );
41
42 system($parallel_command);
3743 1;
3844 }
3945
114114 unlink($output_blast_results_filename) unless($self->dont_delete_files == 1);
115115
116116 my $post_analysis = Bio::Roary::External::PostAnalysis->new(
117 job_runner => $self->job_runner,
117 job_runner => 'Local',
118118 cpus => $self->cpus,
119119 fasta_files => $self->fasta_files,
120120 input_files => $self->input_files,