From 68c12a3e319615f9c111b899ea4f44ea600ff5d8 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jan=20Kr=C3=BCger?= Date: Fri, 5 Nov 2010 03:24:03 +0100 Subject: [PATCH] jobd: make progress output time-dependent MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Up until now, jobd displayed progress approximately every ten jobs. That is sometimes a lot and sometimes not very much. Instead, make it display roughly once per minute. Signed-off-by: Jan Krüger --- jobd/jobd.pl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index 7827885..caf1bcd 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -195,7 +195,7 @@ sub reap_finished_jobs { } sub run_queue { - my $queue_steps = 0; + my $last_progress = time; $jobs_executed = 0; @jobs_killed = (); unless ($quiet) { @@ -208,16 +208,16 @@ sub run_queue { # Back off if we're too busy if (@running >= $max_par) { sleep 10; - $queue_steps++; - unless (($quiet && !$progress) || ($queue_steps % 10)) { + unless (($quiet && !$progress) || (time - $last_progress) < 60) { printf STDERR "STATUS: %d queued, %d running, %d finished, %d killed\n", scalar(@queue), scalar(@running), $jobs_executed, scalar(@jobs_killed); if (@running) { my @run_status; for (@running) { - push @run_status, _job_name($_)." for ". (time - $_->{'started_at'}) ."s"; + push @run_status, _job_name($_)." ". (time - $_->{'started_at'}) ."s"; } error("STATUS: currently running: ". join(', ', @run_status)); } + $last_progress = time; } next; } -- 2.11.4.GIT