[padb] r396 committed - Pass the previous commit through perltidy to ensure consistency.
padb at googlecode.com
padb at googlecode.com
Sun Oct 24 00:34:15 BST 2010
Revision: 396
Author: apittman at gmail.com
Date: Sat Oct 23 16:33:23 2010
Log: Pass the previous commit through perltidy to ensure consistency.
http://code.google.com/p/padb/source/detail?r=396
Modified:
/trunk/src/padb
=======================================
--- /trunk/src/padb Sat Oct 23 16:15:51 2010
+++ /trunk/src/padb Sat Oct 23 16:33:23 2010
@@ -9066,18 +9066,18 @@
#
# PBS support
#
-# Find if parent is resource manager or not
+# Find if parent is resource manager or not
# there's two cases:
# 1- parent immediately is pbs_attach, Ok it's true
# 2- no parent immediately is pbs_attach, so find until mpd & parent is
root
#
# take care of no existing process or immediate parent is 1 or 0
# or proc itself is 'pbs_attach'
-#
+#
# reason to write this:
# in new version of pbspro there's no more pbs_attach
# and in this case padb fails to find any rank procs
-#
+#
# example:
#UID PID PPID C STIME TTY TIME CMD
#thipa 23562 1 0 13:28 ? 00:00:00 python
/opt/mpi/mpibull2-1.3.7-1.t/bin/mpd.py
@@ -9091,38 +9091,45 @@
my $input_pid = shift;
my $result;
my $parent_pid = find_from_status( $input_pid, 'PPid' );
- my $name_pid = find_from_status( $input_pid, 'Name');
- return if (!defined ($parent_pid) || $parent_pid == 1 || $parent_pid
== 0 || $name_pid eq 'pbs_attach');
+ my $name_pid = find_from_status( $input_pid, 'Name' );
+ return
+ if ( !defined($parent_pid)
+ || $parent_pid == 1
+ || $parent_pid == 0
+ || $name_pid eq 'pbs_attach' );
+
# loop to find its parents
- my $pid = $parent_pid;
+ my $pid = $parent_pid;
my $loop = 0;
- for (;;) {
- # find PPid of this pid
- my $ppid = find_from_status( $pid, 'PPid' );
- my @name = slurp_file("/proc/$pid/cmdline");
- $loop++;
- my $line = $name[0];
- my @champs = split(/\0+/,$line);
- if ($loop == 1 ) {
- if ($champs[0] eq 'pbs_attach') {
- $result = 1; # OK parent is resm
- last;
- }
- if ($ppid == 1 || $ppid == 0) {
- last; # parent is root last anyway
- }
- } elsif ($loop >= 2) {
- if ($ppid == 1 || $ppid == 0) {
- if (defined($champs[1]) && $champs[1] =~ /mpd.py/) {
- $result = 1 # OK parent is resm
- }
- last; # parent is root last anyway
- }
- }
- $pid=$ppid;
+ for ( ; ; ) {
+
+ # find PPid of this pid
+ my $ppid = find_from_status( $pid, 'PPid' );
+ my @name = slurp_file("/proc/$pid/cmdline");
+ $loop++;
+ my $line = $name[0];
+ my @champs = split( /\0+/, $line );
+ if ( $loop == 1 ) {
+ if ( $champs[0] eq 'pbs_attach' ) {
+ $result = 1; # OK parent is resm
+ last;
+ }
+ if ( $ppid == 1 || $ppid == 0 ) {
+ last; # parent is root last anyway
+ }
+ } elsif ( $loop >= 2 ) {
+ if ( $ppid == 1 || $ppid == 0 ) {
+ if ( defined( $champs[1] ) && $champs[1] =~ /mpd.py/ ) {
+ $result = 1 # OK parent is resm
+ }
+ last; # parent is root last anyway
+ }
+ }
+ $pid = $ppid;
}
return ($result);
}
+
#
sub pbs_find_pids {
my $job = shift;
More information about the padb-devel
mailing list