diff --git a/modules/Bio/EnsEMBL/Hive/Analysis.pm b/modules/Bio/EnsEMBL/Hive/Analysis.pm index 663fd0ba6e301c1b77200882e39ee8accb4cf892..dfe32a4fe037ce72f1a1bf35fab4812bd5a3e4ef 100644 --- a/modules/Bio/EnsEMBL/Hive/Analysis.pm +++ b/modules/Bio/EnsEMBL/Hive/Analysis.pm @@ -167,7 +167,7 @@ sub display_name { my ($self, $ref_dba) = @_; # if reference dba is the same as 'our' dba, a shorter display_name is generated my $adaptor = $self->adaptor; - return ($adaptor and $adaptor->db ne ($ref_dba//'') ) ? $adaptor->db->dbc->dbname.'/'.$self->logic_name : $self->logic_name; + return ( ($adaptor and $adaptor->db ne ($ref_dba//'') ) ? $adaptor->db->dbc->dbname . '/' : '' ) . $self->logic_name; } @@ -187,9 +187,8 @@ sub stats { my $collection = Bio::EnsEMBL::Hive::AnalysisStats->collection(); - return $collection - ? $collection->find_one_by('analysis', $self) - : $self->adaptor->db->get_AnalysisStatsAdaptor->fetch_by_analysis_id( $self->dbID ); + return ($collection && $collection->find_one_by('analysis', $self) ) + || $self->adaptor->db->get_AnalysisStatsAdaptor->fetch_by_analysis_id( $self->dbID ); } diff --git a/modules/Bio/EnsEMBL/Hive/Queen.pm b/modules/Bio/EnsEMBL/Hive/Queen.pm index 1498f0be05ed111613d8ab033c904d563e1ba602..d92430b22617fb1ae338b82cbca8e09753c82cc3 100644 --- a/modules/Bio/EnsEMBL/Hive/Queen.pm +++ b/modules/Bio/EnsEMBL/Hive/Queen.pm @@ -662,25 +662,29 @@ sub get_num_failed_analyses { sub get_remaining_jobs_show_hive_progress { - my $self = shift; - 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 ". - "FROM analysis_stats"; - my $sth = $self->prepare($sql); - $sth->execute(); - my ($done, $failed, $total, $cpuhrs) = $sth->fetchrow_array(); - $sth->finish; - - $done ||= 0; - $failed ||= 0; - $total ||= 0; - my $completed = $total + my ($self, $filter_analysis) = @_; + + my $sql =qq{ 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 + FROM analysis_stats } + . ($filter_analysis ? " WHERE analysis_id=".$filter_analysis->dbID : ''); + + my $sth = $self->prepare($sql); + $sth->execute(); + my ($done, $failed, $total, $cpuhrs) = $sth->fetchrow_array(); + $sth->finish; + + $done ||= 0; + $failed ||= 0; + $total ||= 0; + my $completed = $total ? ((100.0 * ($done+$failed))/$total) : 0.0; - my $remaining = $total - $done - $failed; - warn sprintf("hive %1.3f%% complete (< %1.3f CPU_hrs) (%d todo + %d done + %d failed = %d total)\n", - $completed, $cpuhrs, $remaining, $done, $failed, $total); - return $remaining; + my $remaining = $total - $done - $failed; + warn sprintf("%30s %1.3f%% complete (< %1.3f CPU_hrs) (%d todo + %d done + %d failed = %d total)\n", + ($filter_analysis ? "analysis '".$filter_analysis->logic_name."'" : 'hive'), $completed, $cpuhrs, $remaining, $done, $failed, $total); + + return $remaining; } diff --git a/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm b/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm index 2c797813659e2671ebdcad2ba6b4f4ce789c021b..f6abc89d36de7876b9369a7d699cdbb49bb18af7 100644 --- a/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm +++ b/modules/Bio/EnsEMBL/Hive/Utils/Graph.pm @@ -189,6 +189,8 @@ sub build { $target_object = $df_rule->to_analysis(); $target_object->{'_foreign'}=1; Bio::EnsEMBL::Hive::Analysis->collection()->add( $target_object ); # add it to the collection + my $foreign_stats = $target_object->stats or die "Could not fetch foreign stats for ".$target_object->display_name( $self->hive_dba ); + Bio::EnsEMBL::Hive::AnalysisStats->collection()->add( $foreign_stats ); # add it to the collection } if( my $funnel_dataflow_rule = $df_rule->funnel_dataflow_rule ) { @@ -201,6 +203,8 @@ sub build { my $condition_analysis = $c_rule->condition_analysis(); $condition_analysis->{'_foreign'}=1; Bio::EnsEMBL::Hive::Analysis->collection()->add( $condition_analysis ); # add it to the collection + my $foreign_stats = $condition_analysis->stats or die "Could not fetch foreign stats for ".$condition_analysis->display_name( $self->hive_dba ); + Bio::EnsEMBL::Hive::AnalysisStats->collection()->add( $foreign_stats ); # add it to the collection } } diff --git a/scripts/beekeeper.pl b/scripts/beekeeper.pl index 332c0efc263ba022ec3f84c823f4c53eeae70ec7..541de856c60f5530c38b6dd3a95d58b22e925887 100755 --- a/scripts/beekeeper.pl +++ b/scripts/beekeeper.pl @@ -265,6 +265,7 @@ sub main { $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 + $queen->get_remaining_jobs_show_hive_progress( $analysis ) if ($analysis); $queen->get_remaining_jobs_show_hive_progress(); if($show_failed_jobs) { @@ -383,8 +384,8 @@ sub run_autonomously { print "Not submitting any workers this iteration\n"; } - $failed_analyses = $queen->get_num_failed_analyses($run_analysis); - $num_of_remaining_jobs = $queen->get_remaining_jobs_show_hive_progress(); + $failed_analyses = $queen->get_num_failed_analyses( $run_analysis ); + $num_of_remaining_jobs = $queen->get_remaining_jobs_show_hive_progress( $run_analysis ); } while( $keep_alive or (!$failed_analyses and $num_of_remaining_jobs and $iteration!=$max_loops) );