From abe2a947e75d28e041ca69b32158ebb67d0560dc Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kr=C3=BCger?= Date: Fri, 5 Nov 2010 04:11:45 +0100 Subject: [PATCH] jobd: simplify progress code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jan Krüger --- jobd/jobd.pl | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index 2fd6eb6..bd7217d 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -207,7 +207,7 @@ sub run_queue { $jobs_executed = 0; $jobs_skipped = 0; @jobs_killed = (); - unless ($quiet) { + if ($progress) { printf STDERR "--- Processing %d queued jobs\n", scalar(@queue); } $SIG{'CHLD'} = \&handle_childgone; @@ -219,7 +219,7 @@ sub run_queue { # Back off if we're too busy if (@running >= $max_par) { sleep 10; - unless (($quiet && !$progress) || (time - $last_progress) < 60) { + if ($progress && (time - $last_progress) >= 60) { printf STDERR "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; @@ -235,7 +235,7 @@ sub run_queue { # Run next run_job(shift(@queue)) if @queue; } - unless ($quiet) { + if ($progress) { printf STDERR "--- Queue processed. %d jobs executed, %d skipped, %d killed. Now restarting.\n", $jobs_executed, $jobs_skipped, scalar(@jobs_killed); } } @@ -285,6 +285,7 @@ fatal("Error: can only use one out of --all-once and --one") unless ($quiet) { $ENV{'show_progress'} = '1'; + $progress = 1; } if ($one) { -- 2.11.4.GIT