From: Martin Mares Date: Fri, 21 Sep 2012 13:29:07 +0000 (+0200) Subject: "bex queue --filenames" can be used to show job file names X-Git-Tag: v3.1~13 X-Git-Url: http://mj.ucw.cz/gitweb/?a=commitdiff_plain;h=cb1e5843990fbdcee345a345962c152e16a85808;p=bex.git "bex queue --filenames" can be used to show job file names --- diff --git a/lib/bin/bex-queue b/lib/bin/bex-queue index cfeb930..9b01a4e 100755 --- a/lib/bin/bex-queue +++ b/lib/bin/bex-queue @@ -14,6 +14,7 @@ my $op_rm; my $op_move_to; my $queue_name; +my $filenames; my $given_job; my $summary; my $why; @@ -29,6 +30,7 @@ Actions: --move-to= Move jobs to a different queue Options: +-f, --filenames Show filenames of jobs and log files -j, --job= Act on the specified job (default: on all) -q, --queue= Act on the given queue -s, --summary Show only a summary @@ -43,6 +45,7 @@ GetOptions( "h|by-host!" => \$op_by_host, "rm!" => \$op_rm, "move-to=s" => \$op_move_to, + "f|filenames!" => \$filenames, "j|job=s" => \$given_job, "q|queue=s" => \$queue_name, "s|summary!" => \$summary, @@ -92,6 +95,10 @@ sub do_ls() my $s = $st->{"Status"} // "UNKNOWN"; $cnt_by_job{$j}{$s}++; $cnt_by_mach{$m}{$s}++; + $why{$m}{$j} = ""; + if ($filenames) { + $why{$m}{$j} .= "\t\t== Job file: " . $queue->queue_file($m, $j) . "\n"; + } if (defined($st->{'Time'}) && defined($st->{'Status'})) { $stat{$m}{$j} = ' [' . $st->{'Status'} . ' on ' . POSIX::strftime('%Y-%m-%d', localtime $st->{'Time'}) . ']'; @@ -99,7 +106,7 @@ sub do_ls() my $lines = $why ? $why : 3; my $log = $queue->log_file($m, $j); if (-f $log) { - $why{$m}{$j} = join("", map { "\t\t>> $_" } `tail -n$lines $log`); + $why{$m}{$j} .= join("", map { "\t\t>> $_" } `tail -n$lines $log`); } } } else { @@ -131,7 +138,7 @@ sub do_ls() print "$m", ($mach_locked{$m} ? ' [LOCKED]' : ''), "\n"; for my $j (@{$machs{$m}}) { print "\t" . $queue->job_name($j) . $stat{$m}{$j}, "\n"; - print $why{$m}{$j} // ""; + print $why{$m}{$j}; } } } else { @@ -139,7 +146,7 @@ sub do_ls() print $queue->job_name($j), "\n"; for my $m (sort @{$jobs{$j}}) { print "\t$m", $stat{$m}{$j}, "\n"; - print $why{$m}{$j} // ""; + print $why{$m}{$j}; } } }