[padb-devel] [padb] r231 committed - Check for job processes being found when we receive a reply from the i...

codesite-noreply at google.com codesite-noreply at google.com
Thu Sep 10 18:45:48 BST 2009


Revision: 231
Author: apittman
Date: Thu Sep 10 10:44:39 2009
Log: Check for job processes being found when we receive a reply from the  
inner.  This means
that if a job dies whilst it is being watched padb will notice and can shut  
itself
down cleanly.

http://code.google.com/p/padb/source/detail?r=231

Modified:
  /branches/cleanup/src/padb

=======================================
--- /branches/cleanup/src/padb	Thu Sep 10 10:20:25 2009
+++ /branches/cleanup/src/padb	Thu Sep 10 10:44:39 2009
@@ -3260,6 +3260,7 @@
      my ( $output, $lines ) = @_;

      if ( $output eq 'tree' ) {
+
          #print show_tree( make_tree($lines) );
          new_tree($lines);
      } elsif ( $output eq 'compress' ) {
@@ -3710,6 +3711,16 @@
          $comm_data->{state} = 'shutdown';
          return;
      }
+
+    # Check for all processes being found, or rather check for none being  
found.
+    # If there are none then we probably don't have any info from the so  
tell
+    # the inner to quit and don't process any data we have just received.
+    if ( not defined $d->{target_data}{found}{yes} ) {
+        printf("No remaining processes, is job dead?\n");
+        $comm_data->{current_req} = last_command();
+        issue_command_to_inner( $cdata, $comm_data->{current_req} );
+        return;
+    }

      # We have received a reply to a request, send the next
      # request first and then display this reply.  If in
@@ -7219,6 +7230,14 @@
      } else {
          $pid_list = $confInner{all_pids};
      }
+
+    # Record that this processes is still here so the outer process can  
exit if
+    # there is nothing to target.
+    foreach my $proc ( @{$pid_list} ) {
+        if ( -d "/proc/$proc->{pid}" ) {
+            target_key_pair( $proc->{vp}, 'found', 'yes' );
+        }
+    }

      # Now do the work by calling handler or handler_all.  Catch any  
exception
      # errors here and extract the top line of the error to report to the  
user.




More information about the padb-devel mailing list