Skip to content
Snippets Groups Projects
Commit 589b5c8e authored by Leo Gordon's avatar Leo Gordon
Browse files

make sure beekeeper quits when looping in -logic_name XXX mode and there are...

make sure beekeeper quits when looping in -logic_name XXX mode and there are no more jobs in this analysis -- thanks, Irina!
parent 89ee7b98
No related branches found
No related tags found
No related merge requests found
...@@ -662,25 +662,29 @@ sub get_num_failed_analyses { ...@@ -662,25 +662,29 @@ sub get_num_failed_analyses {
sub get_remaining_jobs_show_hive_progress { sub get_remaining_jobs_show_hive_progress {
my $self = shift; my ($self, $filter_analysis) = @_;
my $sql = "SELECT sum(done_job_count), sum(failed_job_count), sum(total_job_count), ".
"sum(ready_job_count * analysis_stats.avg_msec_per_job)/1000/60/60 ". my $sql =qq{ SELECT sum(done_job_count), sum(failed_job_count), sum(total_job_count),
"FROM analysis_stats"; sum(ready_job_count * analysis_stats.avg_msec_per_job)/1000/60/60
my $sth = $self->prepare($sql); FROM analysis_stats }
$sth->execute(); . ($filter_analysis ? " WHERE analysis_id=".$filter_analysis->dbID : '');
my ($done, $failed, $total, $cpuhrs) = $sth->fetchrow_array();
$sth->finish; my $sth = $self->prepare($sql);
$sth->execute();
$done ||= 0; my ($done, $failed, $total, $cpuhrs) = $sth->fetchrow_array();
$failed ||= 0; $sth->finish;
$total ||= 0;
my $completed = $total $done ||= 0;
$failed ||= 0;
$total ||= 0;
my $completed = $total
? ((100.0 * ($done+$failed))/$total) ? ((100.0 * ($done+$failed))/$total)
: 0.0; : 0.0;
my $remaining = $total - $done - $failed; my $remaining = $total - $done - $failed;
warn sprintf("hive %1.3f%% complete (< %1.3f CPU_hrs) (%d todo + %d done + %d failed = %d total)\n", warn sprintf("%30s %1.3f%% complete (< %1.3f CPU_hrs) (%d todo + %d done + %d failed = %d total)\n",
$completed, $cpuhrs, $remaining, $done, $failed, $total); ($filter_analysis ? "analysis '".$filter_analysis->logic_name."'" : 'hive'), $completed, $cpuhrs, $remaining, $done, $failed, $total);
return $remaining;
return $remaining;
} }
......
...@@ -265,6 +265,7 @@ sub main { ...@@ -265,6 +265,7 @@ sub main {
$self->{'dba'}->get_RoleAdaptor->print_active_role_counts; $self->{'dba'}->get_RoleAdaptor->print_active_role_counts;
Bio::EnsEMBL::Hive::Scheduler::schedule_workers_resync_if_necessary($queen, $valley, $analysis); # show what would be submitted, but do not actually submit Bio::EnsEMBL::Hive::Scheduler::schedule_workers_resync_if_necessary($queen, $valley, $analysis); # show what would be submitted, but do not actually submit
$queen->get_remaining_jobs_show_hive_progress( $analysis ) if ($analysis);
$queen->get_remaining_jobs_show_hive_progress(); $queen->get_remaining_jobs_show_hive_progress();
if($show_failed_jobs) { if($show_failed_jobs) {
...@@ -383,8 +384,8 @@ sub run_autonomously { ...@@ -383,8 +384,8 @@ sub run_autonomously {
print "Not submitting any workers this iteration\n"; print "Not submitting any workers this iteration\n";
} }
$failed_analyses = $queen->get_num_failed_analyses($run_analysis); $failed_analyses = $queen->get_num_failed_analyses( $run_analysis );
$num_of_remaining_jobs = $queen->get_remaining_jobs_show_hive_progress(); $num_of_remaining_jobs = $queen->get_remaining_jobs_show_hive_progress( $run_analysis );
} while( $keep_alive } while( $keep_alive
or (!$failed_analyses and $num_of_remaining_jobs and $iteration!=$max_loops) ); or (!$failed_analyses and $num_of_remaining_jobs and $iteration!=$max_loops) );
......
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