From 0cda710559fa5ec876e00a8f2813c1051e13c248 Mon Sep 17 00:00:00 2001
From: Jessica Severin <jessica@ebi.ac.uk>
Date: Thu, 13 Oct 2005 09:48:43 +0000
Subject: [PATCH] added method remaining_job_count which returns the number of
 jobs that are neither done nor failed.  Changed print_stats to show
 remaining_job_count instead of done.  Since this number now counts done to
 zero, it is much easier to read how much work is left to do.

---
 modules/Bio/EnsEMBL/Hive/AnalysisStats.pm | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/modules/Bio/EnsEMBL/Hive/AnalysisStats.pm b/modules/Bio/EnsEMBL/Hive/AnalysisStats.pm
index 9024123e6..0a8f4d5e6 100755
--- a/modules/Bio/EnsEMBL/Hive/AnalysisStats.pm
+++ b/modules/Bio/EnsEMBL/Hive/AnalysisStats.pm
@@ -135,6 +135,13 @@ sub running_job_count {
          - $self->failed_job_count;
 }
 
+sub remaining_job_count {
+  my $self = shift;
+  return $self->total_job_count
+         - $self->done_job_count
+         - $self->failed_job_count;
+}
+
 sub num_required_workers {
   my $self = shift;
   $self->{'_num_required_workers'} = shift if(@_);
@@ -186,10 +193,13 @@ sub print_stats {
   if($mode == 1) {
     # printf("%s(%d) %s %d:ms %d:cpu (%d:q %d:r %d:d %d:f %d:t) [%d/%d workers] (%d secs synched)\n",
     #printf("%30s(%3d) %12s jobs(t:%d,q:%d,d:%d,f:%d) b:%d M:%d w:%d (%d secs old)\n",
-    printf("$name %11s %d:cpum job(%d/%d r:%d f:%d %dms) worker[%d/%d] (sync %d)\n",
+    printf("$name %11s %d:cpum job(%d/%d run:%d fail:%d %dms) worker[%d/%d] (sync %d)\n",
         $self->status,
 	$self->cpu_minutes_remaining,
-        $self->done_job_count,$self->total_job_count,$self->running_job_count,$self->failed_job_count,
+        $self->remaining_job_count,
+        $self->total_job_count,
+        $self->running_job_count,
+        $self->failed_job_count,
         $self->avg_msec_per_job,
         $self->num_required_workers, $self->hive_capacity,
         $self->seconds_since_last_update,
-- 
GitLab