Commit 0f7687a8 authored by Jessica Severin's avatar Jessica Severin
Browse files

added queen method print_hive_status for printing a summary of the

state of all jobs on the hive.  added get_analysis method to
AnalysisStates which loads the analysis for the analysis_id.  Modified
print_stats to produce a more descriptive table of stats.
parent 23391588
...@@ -53,6 +53,14 @@ sub analysis_id { ...@@ -53,6 +53,14 @@ sub analysis_id {
return $self->{'_analysis_id'}; return $self->{'_analysis_id'};
} }
sub get_analysis {
my $self = shift;
unless($self->{'_analysis'}) {
$self->{'_analysis'} = $self->adaptor->db->get_AnalysisAdaptor->fetch_by_dbID($self->analysis_id);
}
return $self->{'_analysis'};
}
sub status { sub status {
my ($self, $value ) = @_; my ($self, $value ) = @_;
...@@ -126,12 +134,12 @@ sub determine_status { ...@@ -126,12 +134,12 @@ sub determine_status {
sub print_stats { sub print_stats {
my $self = shift; my $self = shift;
printf("ANALYSIS_STATS (%d) %s batch=%d capacity=%d jobs(%d,%d,%d) clutchSize=%d (age %d secs)\n", printf("STATS %20s(%3d) %12s jobs(t=%d,r=%d,d=%d) batch=%d capacity=%d clutchSize=%d (age %d secs)\n",
$self->get_analysis->logic_name,
$self->analysis_id, $self->analysis_id,
$self->status, $self->status,
$self->batch_size,$self->hive_capacity(),
$self->total_job_count,$self->unclaimed_job_count,$self->done_job_count, $self->total_job_count,$self->unclaimed_job_count,$self->done_job_count,
$self->num_required_workers, $self->batch_size,$self->hive_capacity(),$self->num_required_workers,
$self->seconds_since_last_update); $self->seconds_since_last_update);
} }
......
...@@ -304,6 +304,16 @@ sub check_blocking_control_rules ...@@ -304,6 +304,16 @@ sub check_blocking_control_rules
} }
} }
sub print_hive_status
{
my $self = shift;
my $allStats = $self->db->get_AnalysisStatsAdaptor->fetch_all();
foreach my $analysis_stats (@{$allStats}) {
$analysis_stats->print_stats;
}
}
......
...@@ -300,6 +300,7 @@ sub run ...@@ -300,6 +300,7 @@ sub run
$self->cause_of_death('JOB_LIMIT'); $self->cause_of_death('JOB_LIMIT');
} }
if(($self->life_span()>0) and ((time() - $self->{'start_time'}) > $self->life_span())) { if(($self->life_span()>0) and ((time() - $self->{'start_time'}) > $self->life_span())) {
printf("life_span exhausted (alive for %d secs)\n", (time() - $self->{'start_time'}));
$self->cause_of_death('LIFESPAN'); $self->cause_of_death('LIFESPAN');
} }
if($self->cause_of_death) { $alive=undef; } if($self->cause_of_death) { $alive=undef; }
......
...@@ -74,6 +74,7 @@ my $queen = $DBA->get_Queen; ...@@ -74,6 +74,7 @@ my $queen = $DBA->get_Queen;
$queen->update_analysis_stats(); $queen->update_analysis_stats();
$queen->check_blocking_control_rules; $queen->check_blocking_control_rules;
$queen->print_hive_status;
run_next_worker_clutch($self, $queen); run_next_worker_clutch($self, $queen);
...@@ -132,14 +133,9 @@ sub run_next_worker_clutch ...@@ -132,14 +133,9 @@ sub run_next_worker_clutch
my $self = shift; my $self = shift;
my $queen = shift; my $queen = shift;
$queen->update_analysis_stats();
my $clutches = $queen->db->get_AnalysisStatsAdaptor->fetch_by_needed_workers(); my $clutches = $queen->db->get_AnalysisStatsAdaptor->fetch_by_needed_workers();
foreach my $analysis_stats (@{$clutches}) { print("\n");
$analysis_stats->print_stats;
}
foreach my $analysis_stats (@{$clutches}) { foreach my $analysis_stats (@{$clutches}) {
##my($analysis_id, $count) = $queen->next_clutch(); ##my($analysis_id, $count) = $queen->next_clutch();
#if($count>0) { #if($count>0) {
......
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