]> mj.ucw.cz Git - bex.git/commitdiff
bex prun: Fix handling of failure states with no job attached
authorMartin Mares <mj@ucw.cz>
Tue, 25 Feb 2014 09:45:30 +0000 (10:45 +0100)
committerMartin Mares <mj@ucw.cz>
Tue, 25 Feb 2014 09:45:30 +0000 (10:45 +0100)
A perfect example is the LOCKED state.

lib/bin/bex-prun

index c20f6bc8d09ce8042d9e653006ae9d4ddbb4b4e2..e1ae42ea999e424a4cf9ec9eb14cee2d22193f62 100755 (executable)
@@ -333,9 +333,11 @@ sub redraw_slot($) {
        $C->bkgdset(0);
        $C->addstr(sprintf("%3dD %3dW", $jcnt->{'done'}, $jcnt->{'ready'}));
        if ($stat eq 'DONE') {
-               if (defined $host_last_fail_stat{$mach}) {
-                       $C->bkgdset(($host_last_fail_stat{$mach} eq 'NOPING') ? COLOR_PAIR(5) : COLOR_PAIR(4));
-                       $C->addstr(sprintf("  %-8s %s", $host_last_fail_stat{$mach}, $queue->job_name($host_last_fail_job{$mach})));
+               my $lfs = $host_last_fail_stat{$mach};
+               my $lfj = $host_last_fail_job{$mach};
+               if (defined $lfs) {
+                       $C->bkgdset(($lfs eq 'NOPING') ? COLOR_PAIR(5) : COLOR_PAIR(4));
+                       $C->addstr(sprintf("  %-8s %s", $lfs, $lfj ? $queue->job_name($lfj) : ""));
                }
        } else {
                my $text = sprintf("  %-8s %s", $stat, $jname);
@@ -377,7 +379,7 @@ sub update($$$$) {
                                $ui->set_job_status($mach, $jid, 'failed');
                        } else {
                                for my $j (keys %{$job_state{$mach}}) {
-                                       $ui->set_job_status($mach, $jid, 'failed');
+                                       $ui->set_job_status($mach, $j, 'failed');
                                }
                                $ui->set_host_status($mach, 'failed');
                                $host_last_fail_job{$mach} = $jid;