From 03d41b8aafbab9dcf44b9b54d5130d20cd0bc27c Mon Sep 17 00:00:00 2001 From: Martin Mares Date: Sat, 19 Jan 2013 20:11:17 +0100 Subject: [PATCH] bex prun: Added --debug --- lib/bin/bex-prun | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/bin/bex-prun b/lib/bin/bex-prun index 280877a..a6c14e8 100755 --- a/lib/bin/bex-prun +++ b/lib/bin/bex-prun @@ -11,6 +11,7 @@ use BEX; my $queue_name; my $text_mode; +my $debug; my $debug_children; sub usage() { @@ -18,7 +19,8 @@ sub usage() { Usage: bex prun [] [[!] ...] Options: - --debug-children Log stdout and stderr to ./debug.log + --debug Log status changes to stderr + --debug-children Log stdout and stderr of child processes to ./debug.log -p, --parallel= Set limit on the number of jobs run in parallel -q, --queue= Run jobs in the given queue --text Use plain-text user interface instead of curses @@ -29,6 +31,7 @@ AMEN GetOptions( "q|queue=s" => \$queue_name, "text!" => \$text_mode, + "debug!" => \$debug, "debug-children!" => \$debug_children, "p|parallel=i" => \$BEX::Config::max_parallel_jobs, "help" => \&usage, @@ -80,6 +83,7 @@ while (keys %running || @machines) { } $_ = ; chomp; + print STDERR "<< $_\n" if $debug; my ($mach, $jid, $stat) = /^! (\S+) (\S+) (\S+)$/; if (!defined $stat) { $ui->err("Received invalid status message <$_>"); @@ -205,6 +209,7 @@ sub err($$) { sub set_host_status($$$) { my ($ui, $mach, $stat) = @_; + print STDERR "H: $mach $stat\n" if $debug; my $prev_stat = $host_state{$mach}; if (defined $prev_stat) { $host_cnt{$prev_stat}--; @@ -217,6 +222,7 @@ sub set_host_status($$$) { sub set_job_status($$$$) { my ($ui, $mach, $jid, $stat) = @_; + print STDERR "J: $mach $jid $stat\n" if $debug; my $prev_stat = $job_state{$mach}{$jid} // 'unknown'; $job_cnt{$mach}{$prev_stat}--; $job_cnt{'*'}{$prev_stat}--; @@ -282,8 +288,10 @@ sub place_slot($) { if (defined $besti) { if ($best) { + print STDERR "I: Replacing ", $best->{'Host'}, " (pri $bestpri)\n"; delete $best->{'Row'}; } + print STDERR "I: Allocated ", $s->{'Host'}, " \@$besti (pri $pri)\n"; $s->{'Row'} = $besti; $by_row[$besti] = $s; } -- 2.39.2