jobd: output progress even when not busy
authorJan Krüger <jk@jk.gs>
Wed, 24 Nov 2010 17:09:13 +0000 (24 18:09 +0100)
committerKyle J. McKay <mackyle@gmail.com>
Fri, 31 May 2013 11:37:00 +0000 (31 04:37 -0700)
Previously, jobd would not output any progress messages if it happened
that, at each check, the maximum number of simultaneous jobs was almost
reached but not quite. Instead, output progress regardless of how busy
(or not) we are.

Signed-off-by: Jan Krüger <jk@jk.gs>
jobd/jobd.pl

index 54d26a0..86f8209 100755 (executable)
@@ -261,20 +261,21 @@ sub run_queue {
        while (@queue || @running) {
                reap_hanging_jobs();
                my $proceed_immediately = reap_finished_jobs();
+               # Status output
+               if ($progress && (time - $last_progress) >= 60) {
+                       printf STDERR ts() ."status: %d queued, %d running, %d finished, %d skipped, %d killed\n", scalar(@queue), scalar(@running), $jobs_executed, $jobs_skipped, scalar(@jobs_killed);
+                       if (@running) {
+                               my @run_status;
+                               for (@running) {
+                                       push @run_status, _job_name($_)." ". (time - $_->{'started_at'}) ."s";
+                               }
+                               error("STATUS: currently running: ". join(', ', @run_status));
+                       }
+                       $last_progress = time;
+               }
                # Back off if we're too busy
                if (@running >= $max_par || have_intensive_jobs() >= $max_par_intensive || !@queue) {
                        sleep 1 unless $proceed_immediately;
-                       if ($progress && (time - $last_progress) >= 60) {
-                               printf STDERR ts() ."STATUS: %d queued, %d running, %d finished, %d skipped, %d killed\n", scalar(@queue), scalar(@running), $jobs_executed, $jobs_skipped, scalar(@jobs_killed);
-                               if (@running) {
-                                       my @run_status;
-                                       for (@running) {
-                                               push @run_status, _job_name($_)." ". (time - $_->{'started_at'}) ."s";
-                                       }
-                                       error("STATUS: currently running: ". join(', ', @run_status));
-                               }
-                               $last_progress = time;
-                       }
                        next;
                }
                # Run next