Commit d9421d8e authored by Jessica Severin's avatar Jessica Severin
Browse files

modified so that batch_size is dynamically pulled from hive so that

workers can change batch_size as they run.
parent 4e1bd2ee
......@@ -73,6 +73,7 @@ sub status {
sub batch_size {
my $self = shift;
$self->{'_batch_size'} = shift if(@_);
$self->{'_batch_size'}=1 unless($self->{'_batch_size'});
return $self->{'_batch_size'};
}
......
......@@ -136,7 +136,6 @@ sub create_new_worker {
if($worker and $analysisStats) {
$analStatsDBA->update_status($analysis_id, 'WORKING');
$worker->batch_size($analysisStats->batch_size);
}
return $worker;
}
......
......@@ -63,6 +63,7 @@ package Bio::EnsEMBL::Hive::Worker;
use strict;
use Bio::EnsEMBL::Utils::Argument;
use Bio::EnsEMBL::Utils::Exception;
use Sys::Hostname;
use Bio::EnsEMBL::Analysis;
use Bio::EnsEMBL::DBSQL::DBAdaptor;
......@@ -258,9 +259,14 @@ sub print_worker {
sub batch_size {
my $self = shift;
if(@_) { $self->{'_batch_size'} = shift; }
$self->{'_batch_size'}=1 unless($self->{'_batch_size'});
return $self->{'_batch_size'};
if(@_) {
my $batch_size = shift;
my $stats = $self->analysis->stats;
$stats->batch_size($batch_size);
$stats->update;
}
return $self->analysis->stats->batch_size;
}
......@@ -308,6 +314,9 @@ sub run
printf("life_span exhausted (alive for %d secs)\n", (time() - $self->{'start_time'}));
$self->cause_of_death('LIFESPAN');
}
#unless($self->check_system_load()) {
# $self->cause_of_death('SYS_OVERLOAD');
#}
if($self->cause_of_death) { $alive=undef; }
}
#have runnable cleanup any global/process files/data it may have created
......@@ -315,6 +324,9 @@ sub run
$self->queen->register_worker_death($self);
printf("dbc %d disconnect cycles\n", $self->db->dbc->disconnect_count);
print("total jobs completes : ", $self->work_done, "\n");
if($self->output_dir()) {
close STDOUT;
close STDERR;
......@@ -423,4 +435,15 @@ sub close_and_update_job_output
}
sub check_system_load {
my $self = shift;
my $host = hostname;
my $numCpus = `grep -c '^process' /proc/cpuinfo`;
print("host: $host cpus:$numCpus\n");
return 1; #everything ok
}
1;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment