[padb-devel] [padb] r271 committed - Finally found a way of re-indenting comment blocks, M-q in emacs with...

codesite-noreply at google.com codesite-noreply at google.com
Wed Sep 30 17:35:27 BST 2009


Revision: 271
Author: apittman
Date: Wed Sep 30 09:34:29 2009
Log: Finally found a way of re-indenting comment blocks, M-q in emacs with
set-fill-column set to 75.  Re-indent all comments according, no code
changes.

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

Modified:
  /branches/cleanup/src/padb

=======================================
--- /branches/cleanup/src/padb	Fri Sep 25 14:20:28 2009
+++ /branches/cleanup/src/padb	Wed Sep 30 09:34:29 2009
@@ -24,9 +24,9 @@

  # Revision history
  # Version 3.0
-#  * Full-duplex communication between inner and outer processes, padb
-#    no longer simply sends request on the command line and processes
-#    the response but is truly interactive between the inner and outer
+#  * Full-duplex communication between inner and outer processes, padb no
+#    longer simply sends request on the command line and processes the
+#    response but is truly interactive between the inner and outer
  #    processes.  This avails greater flexibility in what can be achieved
  #    and hopefully helps with scalability as well.
  #  * Enabled warnings (-w) by default.  Fixed lots of warnings, mostly
@@ -34,22 +34,23 @@
  #  * Much more complete separation into "modes" of operation, most options
  #    are now mode specific rather than simply using global variables or
  #    global conf options.
-#  * Overhaul of the allfns (mode) callbacks and in particular their  
parameters
+#  * Overhaul of the allfns (mode) callbacks and in particular their
+#    parameters
  #  * Performance improvements.
-#  * Simplify the slurm_find_pids() function to just return the output
-#    of scontrol listpids
+#  * Simplify the slurm_find_pids() function to just return the output of
+#    scontrol listpids
  #  * Take the old process-tree walking code from slurm_find_pids() and make
-#    it independant and call it for all resource managers.  This allows  
scripts
-#    which call parallel applications to be bypassed and the applications
-#    themselves targetted.
-#  * Added "port-range" option to limit port usage in case people try and  
use
-#    padb with firewalls enabled.
+#    it independant and call it for all resource managers.  This allows
+#    scripts which call parallel applications to be bypassed and the
+#    applications themselves targetted.
+#  * Added "port-range" option to limit port usage in case people try and
+#    use padb with firewalls enabled.
  #
  # Version 2.5
  #  * First Non-Quadrics version
  #  * Various stability/bug fixes.
-#  * Deadlock detect at the MPI Layer rather than the Elan layer
-#    if running with a patched MPI (Work in progress)
+#  * Deadlock detect at the MPI Layer rather than the Elan layer if running
+#    with a patched MPI (Work in progress)
  #  * Completely new build and packing procedure to go with the new
  #    maintainer.
  #  * Added "orte" to the list of resource managers supported
@@ -57,97 +58,109 @@
  #  * inner_main() now uses callbacks for resource manager support.
  #  * --signal now takes names rather than numbers.
  #  * Check job is valid when using the --full-report option.
-#  * Add a --proc-summary option to replace --proc-info --proc-format
-#    This gives a very efficient "job top" program.
-
+#  * Add a --proc-summary option to replace --proc-info --proc-format This
+#    gives a very efficient "job top" program.
  # Version 2.2
-#  * Add a --core-stack option along with --core and --exe to extract stack
-#    traces from core files.
+# * Add a --core-stack option along with --core and --exe to extract stack
+#   traces from core files.
  #
  # Version 2.1
-#  * Add some magic to return complex perl data structures back from the  
inner
-#    callback functions to the output callback function.  
(nfreeze/base64_encode).
-#  * Add "MPI watch" functionality to allow viewing of MPI state in a  
vmstat
-#    like fashion.
-#  * Add a --list-rmgrs option to list active resource managers and their  
jobs.
+#  * Add some magic to return complex perl data structures back from the
+#    inner callback functions to the output callback
+#    function. (nfreeze/base64_encode).
+#  * Add "MPI watch" functionality to allow viewing of MPI state in a
+#    vmstat like fashion.
+#  * Add a --list-rmgrs option to list active resource managers and their
+#    jobs.
  #  * Add support for "local-qsnet" as a way of launching jobs.
  #  * Add support for "local-fd" as a way of launching jobs.
  #  * Add support for "mpd" as a way of launching jobs.
-#  * Add support for "lsf-rms" as a way of launching jobs.  Note the  
lsf/rms
-#    integration means this is highly unlikely to work for everyone.
-#  * Add a -Olsf-job-offset option for finding lsf jobs in the rms  
database.
+#  * Add support for "lsf-rms" as a way of launching jobs.  Note the
+#    lsf/rms integration means this is highly unlikely to work for
+#    everyone.
+#  * Add a -Olsf-job-offset option for finding lsf jobs in the rms
+#  * database.
  #  * Support for MPI message queues as well as libelan queues (-Q)
  #  * Add a -Ominfo=<exe> option for finding the new minfo.x command.
  #  * Add a -Ompi-dll=<dll.so> option for overriding the debugger dll.
  #  * Extend the gdb handling code to allow further expansion in the future.
  #  * Make the strip-below and strip-above functions configurable.
-#  * Add support for loading settings from the environment or a config  
file.
-#  * Add support for "local" as a resource manager to target hand-crafted  
capabilities.
+#  * Add support for loading settings from the environment or a config
+#    file.
+#  * Add support for "local" as a resource manager to target hand-crafted
+#    capabilities.
  #  * Ignore case when matching stats names.
  #  * Correct printing of debug information from the inner.
  #  * Try and remove warnings when run with -w (still disabled)
  #  * Un-break it on slurm systems without RMS installed.
  #  * Preliminary threading support (courtesy of LLNL)
  #  * Show per-rail sdram usage of processes.
-#  * Look at all descendant processes of slurmstepd rather than direct  
descendants
-#    and try and avoid scripts (perl/sh/bash/xterm)
-#  * Use the new scontrol listpids and %A options to squeue for finding  
processes
-#    on slurm systems (1.2.0 and above).
+#  * Look at all descendant processes of slurmstepd rather than direct
+#    descendants and try and avoid scripts (perl/sh/bash/xterm)
+#  * Use the new scontrol listpids and %A options to squeue for finding
+#    processes on slurm systems (1.2.0 and above).
  #  * Don't show usage on command line errors.
-#  * Only pass command line options onto the inner if it is going to  
handle them
+#  * Only pass command line options onto the inner if it is going to handle
+#  * them
  #
  # Version 2.0
-#  * Removed the -OscriptDir option as it's no longer used, use -Oedb  
instead.
+#  * Removed the -OscriptDir option as it's no longer used, use -Oedb
+#    instead.
  #  * Corrected the way tally statistics were being added.
  #  * Added a --show-jobs option to show possible jobs in a resource manager
  #    independent way.
-#  * Added a --local-stats option to show message statistics for all  
processes
-#    on the local node.
-#  * Added a --proc-format option which allows specific entries from /proc  
to be
-#    reported on a per-vp basis.
-#  * Ported to slurm only systems where the RMS kernel module isn't  
present.
-#  * Removed the padb-helper.pl file and folded it's functionality into  
padb
-#    itself. Padb is now self-contained.
+#  * Added a --local-stats option to show message statistics for all
+#    processes on the local node.
+#  * Added a --proc-format option which allows specific entries from /proc
+#    to be reported on a per-vp basis.
+#  * Ported to slurm only systems where the RMS kernel module isn't
+#    present.
+#  * Removed the padb-helper.pl file and folded it's functionality into
+#    padb itself. Padb is now self-contained.
  #  * Removed the padb.gdb file from the kit, it's generated at run-time if
  #    needed.
  #  * Various readability fixes and small performance improvements.
-#  * Added a --kill option along with --signal which can be used to send  
signals
-#    to any process in the parallel job.
+#  * Added a --kill option along with --signal which can be used to send
+#    signals to any process in the parallel job.
  #
  # Version 1.6
-#  * Add a --proc-info option to show the contents of files from /proc for  
a
-#    given rank
+#  * Add a --proc-info option to show the contents of files from /proc for
+#    a given rank
  #  * Increase the RMS_EXITTIMEOUT value from 10 to 30 seconds and make it a
  #    configuration option.
  #
  # Version 1.5
-#  * Try and load edb from where padb is installed. This should allow it  
to run
-#    on elan3 systems where the qsnetdefault link is set to elan3.
-#  * GNAT:8110 Proper use of English in the group deadlock detection  
report.
-#  * Target the correct process if there are multiple processes for each  
vp.
-#    Use the pid of the process which called elan_baseInit()
-#  * GNAT 7945: Fix messages on stderr about integer overflow on 32 bit  
machines
+#  * Try and load edb from where padb is installed. This should allow it to
+#    run on elan3 systems where the qsnetdefault link is set to elan3.
+#  * GNAT:8110 Proper use of English in the group deadlock detection
+#    report.
+#  * Target the correct process if there are multiple processes for each
+#    vp.  Use the pid of the process which called elan_baseInit()
+#  * GNAT 7945: Fix messages on stderr about integer overflow on 32 bit
+#    machines
  #  * Remove warnings when -w is turned on.
-#  * Re-work the stack trace tree generation code do work via a  
intermediate
-#    data structure to make the code easier to parse.
+#  * Re-work the stack trace tree generation code do work via a
+#    intermediate data structure to make the code easier to parse.
  #  * Report errors loading stats from a running job cleanly.
  #  * Better backwards compatibility with older RMS releases.
-#  * Add a padb-treeview script to the release, this takes most of it's  
code
-#    from padb and uses tk to provide the user with a X based view of the  
stack
-#    traces.
+#  * Add a padb-treeview script to the release, this takes most of it's
+#    code from padb and uses tk to provide the user with a X based view of
+#    the stack traces.
  #  * Changes to edb so the stats loading code can run on elan3 systems.
  #
  # Version 1.4
  #  * Bumped version number to 1.4
-#  * Change the format of tree based stack traces, it now uses a more  
logical
-#    indention style.
+#  * Change the format of tree based stack traces, it now uses a more
+#    logical indention style.
  #  * Discover and report if application stats are incomplete.
-#  * Allow the use of -r with -s to view statistics from an individual  
process.
-#    Update -S (which does the same thing) to parse the stats in padb as  
well.
+#  * Allow the use of -r with -s to view statistics from an individual
+#    process.  Update -S (which does the same thing) to parse the stats in
+#    padb as well.
  #  * Improved error handling in the case where jobs complete whilst padb is
-#    running, sample the job state before and after going parallel and do  
the
-#    right thing accordingly.
-#  * Much improved error output, only report an error if something bad  
happened.
+#    running, sample the job state before and after going parallel and do
+#    the right thing accordingly.
+#  * Much improved error output, only report an error if something bad
+#    happened.
  #  * Changes to the code as required to enable padb to run cleanly with
  #    warnings (-w) enabled.
  #  * Added a -Ostats-name= option to allow the extraction of one specific
@@ -156,43 +169,47 @@
  #    parallel to make it more resilient.
  #
  # Version 1.3
-#  * Strip stack traces below main when possible, add a  
--nostrip-below-main
-#    option to turn this off.
+#  * Strip stack traces below main when possible, add a
+#    --nostrip-below-main option to turn this off.
  #  * Strip stack traces above elan_waitWord when possible, add a
  #    --nostrip-above-wait option to turn this off.
-#  * Added a -Ogdb-retry-count=N option. Defaults to three as before but  
is now
-#    tunable.
-#  * Parse communication statistics in padb directly now rather then  
relying on
-#    edb to do it for us
+#  * Added a -Ogdb-retry-count=N option. Defaults to three as before but is
+#    now tunable.
+#  * Parse communication statistics in padb directly now rather then
+#    relying on edb to do it for us
  #  * Allow reading of stats from file (-s -i )
  #  * Perform group deadlock detection in padb directly rather than in edb,
  #    improved the output and handling of corner cases.
-#  * Initial version of a "one process per line" method of statistics  
reporting.
-#  * Better catching and reporting of errors when running parallel  
programs.
+#  * Initial version of a "one process per line" method of statistics
+#    reporting.
+#  * Better catching and reporting of errors when running parallel
+#    programs.
  #  * Bumped the version number to 1.3
  #
  # Version 1.2
-#  * Converted padb to use long command line options. The short ones still  
work
-#    but now have long alternatives
-#  * Removed the need to set -OscriptDir= when running in non-default  
locations
-#  * Added a --full-report=<jobId> option to gather all possible  
information
+#  * Converted padb to use long command line options. The short ones still
+#    work but now have long alternatives
+#  * Removed the need to set -OscriptDir= when running in non-default
+#    locations
+#  * Added a --full-report=<jobId> option to gather all possible
+#    information
  #  * General tidy ups in the stack trace tree generation code.
-#  * Now reports processes that aren't present when generating stack  
traces.
-#  * Now reports errors properly when there are errors launching the  
parallel
-#    job
+#  * Now reports processes that aren't present when generating stack
+#    traces.
+#  * Now reports errors properly when there are errors launching the
+#    parallel job
  #  * Calls edb directly rather than using a helper script when possible
  #    (statistics reports).
  #  * Incremented version number from 1.0 to 1.2.
  #
-
  # TODO:
  #
  # * More testing with -w turned on.
  # * Multi-pass argument handling, --kill also accepts --signal for example,
-#   this should really be done at the getopt layer.  Also proper usage
-#   info for these secondary args.
-# * Paramater checking of secondary args, signal has a hacky  
implementation and
-#   port-range doesn't have any checking currently.
+#   this should really be done at the getopt layer.  Also proper usage info
+#   for these secondary args.
+# * Paramater checking of secondary args, signal has a hacky implementation
+#   and port-range doesn't have any checking currently.
  # * libunwind support?  lighter weight than gdb and possibly more reliable.
  # * Maybe PMI would help?
  # * POD? generated man page?
@@ -257,11 +274,12 @@

  my $secret;

-# Config options the inner knows about, only forward options if they are  
in this list.
+# Config options the inner knows about, only forward options if they are in
+# this list.
  my @inner_conf = qw(edb edbopt minfo rmgr scripts slurm_job_step);

-# More config options the inner knows about, these are forwarded on the  
command line
-# rather than over the sockets.
+# More config options the inner knows about, these are forwarded on the
+# command line rather than over the sockets.
  my @inner_conf_cmd = qw(port_range outer);

   
###############################################################################
@@ -271,8 +289,8 @@
   
###############################################################################

  # A hash of supported resource managers, each of which provides a number of
-# functions for querying the state of the machine.  This keeps the core
-# of the code tidy.   Note that this is only for the "outer" instance of  
the
+# functions for querying the state of the machine.  This keeps the core of
+# the code tidy.  Note that this is only for the "outer" instance of the
  # program, the inner version does things differently.

  # Function        Args Returns   Required Description
@@ -361,11 +379,11 @@
  #
   
###############################################################################

-# If changing any of these defaults also check the inner code as some
-# of these settings affect that program as well and padb will only
-# pass on settings on the command line, not the entire config hash.
-# The reason they are listed here as well is so that padb -O help
-# works and gives the correct defaults.
+# If changing any of these defaults also check the inner code as some of
+# these settings affect that program as well and padb will only pass on
+# settings on the command line, not the entire config hash.  The reason
+# they are listed here as well is so that padb -O help works and gives the
+# correct defaults.

  my %allfns;

@@ -377,8 +395,8 @@
  # Debug options.
  $conf{verbose} = 0;

-# Valid values are "none" "missing" or "all".  Anything not recognised
-# is treated as "all".
+# Valid values are "none" "missing" or "all".  Anything not recognised is
+# treated as "all".
  $conf{check_signon} = 'all';

  # Output options.
@@ -389,9 +407,8 @@
  $conf{local_fd_name}       = '/dev/null';
  $conf{inner_callback}      = 'disabled';

-# These two are used by deadlock and QsNet group
-# code, they need migrating in the group code
-# when I have access to a test system again.
+# These two are used by deadlock and QsNet group code, they need migrating
+# in the group code when I have access to a test system again.
  #$conf{"show-group-members"}  = 0;
  #$conf{"show-all-groups"}     = 0;

@@ -670,10 +687,9 @@
  my %ic_names;
  my %ic_names_cmd;

-# Debugging: this function is called periodically with
-# a mode, an abritary ref and a string, it can either print simply
-# the string or call dumper on the ref as well.
-# Enable with --debug=type1,type2=all
+# Debugging: this function is called periodically with a mode, an abritary
+# ref and a string, it can either print simply the string or call dumper on
+# the ref as well.  Enable with --debug=type1,type2=all
  my %debug_modes;
  my $start_time = time;

@@ -740,8 +756,8 @@
          my ( undef, undef, undef, undef, $owner ) = stat "/proc/$pid";

          # Check the stat worked, it's possible for processes to dissapear
-        # Take care to check for defined rather than true as root has a
-        # uid of zero.
+        # Take care to check for defined rather than true as root has a uid
+        # of zero.
          next unless defined $owner;
          next unless $owner == $uid;
          push @userpids, $pid;
@@ -791,8 +807,8 @@
          $optionhash{ to_arg( $allfns{$arg} ) } = \$config_hash{$arg};
      }

-    # Parse the options once to pick up the mode and any single letter  
options
-    # which might be bundled with it.
+    # Parse the options once to pick up the mode and any single letter
+    # options which might be bundled with it.
      GetOptions(%optionhash);

      Getopt::Long::Configure( 'default', 'bundling' );
@@ -805,8 +821,8 @@
          $have_allfns_option++;
      }

-    # The secondary args, specify all of them for now as we only
-    # call GetOptions once.
+    # The secondary args, specify all of them for now as we only call
+    # GetOptions once.
      my %sec_args;

      # Set any extra options this mode may or may not accept.
@@ -816,8 +832,8 @@
          }
      }

-    # Set this for the second iteration only so that GetOptions can
-    # abort correctly if they are called without a value.
+    # Set this for the second iteration only so that GetOptions can abort
+    # correctly if they are called without a value.
      $optionhash{'config-option|O=s'} = \%config_options;

      GetOptions(%optionhash) or exit 1;
@@ -897,11 +913,10 @@
  #
   
###############################################################################

-# Work around problems with the "hex" function and whilst we are
-# at it avoid warnings as well.
-# Unfortunately hex can't deal with anything bigger than 2^31 without
-# giving an error so simply +0 on the string to convert it to a int
-# cleanly (GNAT 7945).
+# Work around problems with the "hex" function and whilst we are at it
+# avoid warnings as well.  Unfortunately hex can't deal with anything
+# bigger than 2^31 without giving an error so simply +0 on the string to
+# convert it to a int cleanly (GNAT 7945).
  sub _hex {
      my $str = shift;
      if ( not defined $str ) {
@@ -1107,8 +1122,8 @@
      return $ret;
  }

-# These must stay in the correct order, that is the order
-# they appear in shared memory.
+# These must stay in the correct order, that is the order they appear in
+# shared memory.
  my @stat_types = qw(Counter Tally Bin Attribute);

  my @display_order = qw(Attribute Counter Tally Bin);
@@ -1361,20 +1376,19 @@
  sub estats_total {
      my ($data_structures_aref) = @_;

-    # Make an initial total by just copying the first set of stats
-    # carte blance.
+    # Make an initial total by just copying the first set of stats carte
+    # blance.
      my $summed_structure = dclone( $data_structures_aref->[0] );

      for ( my $cr = 1 ; $cr <= $#{$data_structures_aref} ; $cr++ ) {
          my $current_structure = $data_structures_aref->[$cr];

-        # Copy the vp and nvp information, we might miss new entries
-        # in current_structure but for the time being all entries
-        # are known to be common.
-        # XXX: This assertion no longer holds true, {complete} is only
-        # defined where it is known and has values 0 and 1.
-        # Having said that it will all work though as if it's value is not
-        # known it can't be 1 which is the only value we care about.
+        # Copy the vp and nvp information, we might miss new entries in
+        # current_structure but for the time being all entries are known to
+        # be common.  XXX: This assertion no longer holds true, {complete}
+        # is only defined where it is known and has values 0 and 1.  Having
+        # said that it will all work though as if it's value is not known
+        # it can't be 1 which is the only value we care about.
          foreach my $header ( keys %{$summed_structure} ) {
              next if ( $header eq 'subsystems' );
              if ( defined $summed_structure->{$header}
@@ -1675,12 +1689,12 @@
  sub estats_show_stats {
      my $d = shift;

-    # This function is slightly delicate, the --full-report option
-    # calls this function with $stats_total and $group set.
-
-    # What to do about the -r option:
-    # If it's set then display individual results for the given
-    # vp's only, if it's not set then display a total for everyone.
+    # This function is slightly delicate, the --full-report option calls
+    # this function with $stats_total and $group set.
+
+    # What to do about the -r option: If it's set then display individual
+    # results for the given vp's only, if it's not set then display a total
+    # for everyone.

      if ( not $d ) {
          print "QsNet Statistics not valid\n";
@@ -2054,9 +2068,9 @@
      return 1;
  }

-# This function returns an reference to an array of hashes, each
-# hash containing the "txt" of the function name and a further array
-# of hash references called "children".
+# This function returns an reference to an array of hashes, each hash
+# containing the "txt" of the function name and a further array of hash
+# references called "children".
  sub _make_tree {
      my ( $level, $lines, $trange ) = @_;

@@ -2137,8 +2151,8 @@

          # @{ $this{vps} } = ( $tag, @identical );

-        # The plus two here is one for $tag and one to convert
-        # from array idx to number of entries.
+        # The plus two here is one for $tag and one to convert from array
+        # idx to number of entries.
          $this{vpcount} = $#identical + 2;
          $this{vpspec} =
            rng_convert_to_user( rng_create_from_array( ( $tag, @identical )  
) );
@@ -2195,8 +2209,8 @@

      my $ret = $EMPTY_STRING;

-    # Don't need to sort the peers here because make_tree ensures
-    # the are sorted.
+    # Don't need to sort the peers here because make_tree ensures the are
+    # sorted.
      # my @peers = sort { $a->{vps}[0] <=> $b->{vps}[0] } ( @{$ref} );

      my @peers = @{$ref};
@@ -2275,9 +2289,9 @@
          return;
      }

-    # Try to prevent zombie jobs, fairly rare but I have seen
-    # nodes run different versions of edb which can cause problems
-    # XXX: Fixme.  This isn't high enough.
+    # Try to prevent zombie jobs, fairly rare but I have seen nodes run
+    # different versions of edb which can cause problems XXX: Fixme.  This
+    # isn't high enough.
      if ( $conf{prun_exittimeout} != 0 ) {
          $ENV{RMS_EXITTIMEOUT} = $conf{prun_exittimeout};
      }
@@ -2288,10 +2302,9 @@

      {

-        # Work around a couple of bugs in RMS
-        # the first one is really old and was there
-        # for a while, the second one is limited
-        # to 'qsrmslibs-2.82-15'
+        # Work around a couple of bugs in RMS the first one is really old
+        # and was there for a while, the second one is limited to
+        # 'qsrmslibs-2.82-15'
          my $partition = rms_res_to_partition($res);
          $ENV{RMS_PARTITION}  = $partition;
          $ENV{RMS_RESOURCEID} = "$partition.$res";
@@ -2359,7 +2372,7 @@

                  if ( defined $2 ) {

-                    # square braces with range, eg 		    'machine[0-3]'
+                    # square braces with range, eg 'machine[0-3]'
                      for ( $i = $1 ; $i <= $2 ; $i++ ) {
                          push @nodelist, $prefix . $i . $suffix;
                      }
@@ -2408,17 +2421,16 @@
      return @res;
  }

-# Query the process count for the "step" as that's how many
-# processes we are going to be looking for.
+# Query the process count for the "step" as that's how many processes we
+# are going to be looking for.
  sub slurm_job_to_ncpus {
      my $job   = shift;
      my $s     = "$job." . $conf{slurm_job_step};
      my @steps = slurp_cmd("squeue -s $s -o %i,%A");

-    # The %A option is new so ensure we have the TASKS output
-    # before we believe what we see here...
-    # Mind you %A is several years old now so if it's not there
-    # we probably can't do anything anyway.
+    # The %A option is new so ensure we have the TASKS output before we
+    # believe what we see here...  Mind you %A is several years old now so
+    # if it's not there we probably can't do anything anyway.
      my $tasks;
      my $have_tasks = 0;
      chomp @steps;
@@ -2446,8 +2458,7 @@

  # Query the node list for the "step" which isn't the same as the node list
  # for the job, care should be taken if using this function to ensure this
-# is correct.
-# This functions isn't used currently.
+# is correct.  This functions isn't used currently.
  sub slurm_job_to_nodelist {
      my $job   = shift;
      my $s     = "$job." . $conf{slurm_job_step};
@@ -2581,8 +2592,8 @@
      return \%jobs;
  }

-# There is a bug here I think, $user isn't used anywhere
-# which is probably bad.
+# There is a bug here I think, $user isn't used anywhere which is probably
+# bad.
  sub mpd_get_jobs {
      my $user = shift;

@@ -2728,8 +2739,8 @@

  sub lsf_is_installed {

-    # Check for both LSF and RMS, I know LSF works in other ways but I  
don't
-    # know how to launch jobs then...
+    # Check for both LSF and RMS, I know LSF works in other ways but I
+    # don't know how to launch jobs then...
      return ( find_exe('bjobs') and rms_is_installed() );
  }

@@ -2750,11 +2761,11 @@
      return @jobs;
  }

-# This is a little odd, lsf allocates a resource and then pruns (-n1) the  
users script
-# inside that resource.  That script then calls prun which is the real  
parallel job,
-# In essence then you get one resource and (at least) two jobs, padb needs  
to target
-# the second one.  This is controlled by the -Olsf_job_offset option, the  
default being
-# one.
+# This is a little odd, lsf allocates a resource and then pruns (-n1) the
+# users script inside that resource.  That script then calls prun which is
+# the real parallel job, In essence then you get one resource and (at
+# least) two jobs, padb needs to target the second one.  This is controlled
+# by the -Olsf_job_offset option, the default being one.
  sub lsf_setup_pcmd {
      my $job = shift;

@@ -2803,8 +2814,9 @@

  sub find_rmgr {

-# If it's been set on the command line and it's valid then just use what  
we are given.
-# Do sanity checks here but only warn on the result to cope with  
non-default installs.
+    # If it's been set on the command line and it's valid then just use
+    # what we are given.  Do sanity checks here but only warn on the result
+    # to cope with non-default installs.

      if ( defined $conf{rmgr} ) {
          if ( not defined $rmgr{ $conf{rmgr} } ) {
@@ -2842,16 +2854,16 @@
      return;
  }

-# Find any active resource manager, that is --any or --all
-# have been passed on the command line so look for any resource
-# manager that have active jobs, if there is one active resource
-# manager use that one, if there are zero or many exit with an
-# error.
+# Find any active resource manager, that is --any or --all have been passed
+# on the command line so look for any resource manager that have active
+# jobs, if there is one active resource manager use that one, if there are
+# zero or many exit with an error.
  sub find_any_rmgr {
      my ($user) = @_;

-# If it's been set on the command line and it's valid then just use what  
we are given.
-# Do sanity checks here but only warn on the result to cope with  
non-default installs.
+    # If it's been set on the command line and it's valid then just use
+    # what we are given.  Do sanity checks here but only warn on the result
+    # to cope with non-default installs.

      if ( defined $conf{rmgr} ) {
          if ( not defined $rmgr{ $conf{rmgr} } ) {
@@ -2908,8 +2920,8 @@
          return;
      }

-    # Multiple resource managers are installed and have jobs,
-    # bouce back to the user to specify which one they want.
+    # Multiple resource managers are installed and have jobs, bouce back to
+    # the user to specify which one they want.
      print
  "Error, multiple active resource managers detected, use -Ormgr=<resource  
manager>\n";
      push @installed, 'local-fd';
@@ -2981,9 +2993,8 @@

      foreach my $tag ( keys %{$lines} ) {

-        # There was a subtle bug here, functions from the @above_list
-        # often appear below main which this code doesn't handle all that
-        # well.
+        # There was a subtle bug here, functions from the @above_list often
+        # appear below main which this code doesn't handle all that well.
          my $main_idx;
          my $wait_idx = 0;
          for my $l ( 0 .. $#{ $lines->{$tag} } ) {
@@ -3054,9 +3065,9 @@
      return;
  }

-# Convert back from a set of values (with ranges) in a namespace to a  
array of
-# ranks containing the values.  Assume that each rank only appears in the
-# namespace with one value.
+# Convert back from a set of values (with ranges) in a namespace to a array
+# of ranks containing the values.  Assume that each rank only appears in
+# the namespace with one value.
  sub array_from_target_namespace {
      my ($r) = @_;

@@ -3100,11 +3111,10 @@
      return;
  }

-# Nicely format process information.
-# XXX: proc-sort-key should probably sort on column headers as
-# well as keys.
-# Idealy we'd know what format we wanted and only ask the nodes
-# to report relevent info, for now they still report everything.
+# Nicely format process information.  XXX: proc-sort-key should probably
+# sort on column headers as well as keys.  Idealy we'd know what format we
+# wanted and only ask the nodes to report relevent info, for now they still
+# report everything.
  sub show_proc_format {
      my ( $carg, $nlines ) = @_;

@@ -3457,8 +3467,7 @@
      return thaw( decode_base64(shift) );
  }

-# We have read data on a socket, process it and call
-# any callback.
+# We have read data on a socket, process it and call any callback.
  sub extract_line {
      my ( $handle, $sd ) = @_;

@@ -3500,10 +3509,10 @@
  #    return \%comm_tree;
  #}

-# Fairly simple this, walk through the hosts keeping a list
-# of joints (Those able to accept children this iteration) and
-# leaves (those able to accept children next iteration) and
-# loop until there are no more hosts left to add.
+# Fairly simple this, walk through the hosts keeping a list of joints
+# (Those able to accept children this iteration) and leaves (those able to
+# accept children next iteration) and loop until there are no more hosts
+# left to add.
  sub generate_binary_tree {
      my ( $a, $width ) = @_;
      my @b = @{$a};
@@ -3533,10 +3542,9 @@
      return \%comm_tree;
  }

-# For each remote process generate a tree, giving each
-# process a parent and a number of children.
-# Currently just make this a simple "ladder" but should
-# probably be a f-nomial tree.
+# For each remote process generate a tree, giving each process a parent and
+# a number of children.  Currently just make this a simple "ladder" but
+# should probably be a f-nomial tree.
  sub generate_comm_tree {
      my ($a) = @_;

@@ -3593,7 +3601,7 @@
      $req->{remote}          = $comm_data->{remote};

      # Also send over some of the per-run (as opposed to per-mode)
-    # configuration  options.
+    # configuration options.
      # XXX: Need to send over scripts and other stuff here as well.

      if ( $conf{rmgr} eq 'orte' ) {
@@ -3683,8 +3691,8 @@
      return;
  }

-# Check all processes are detected and report an error to the user.   
Return true if
-# there is no processes are detected.
+# Check all processes are detected and report an error to the user.  Return
+# true if there is no processes are detected.
  sub check_signon {
      my ( $comm_data, $data ) = @_;
      return if ( $conf{check_signon} eq 'none' );
@@ -3776,9 +3784,9 @@
      # The inner process has signed on.
      if ( $comm_data->{current_req}->{mode} eq 'signon' ) {

-        # Check the signon messages, reporting minor errors to the user,  
if no
-        # processes are found then don't bother processing any commands  
but just
-        # tell the inner to exit.
+        # Check the signon messages, reporting minor errors to the user, if
+        # no processes are found then don't bother processing any commands
+        # but just tell the inner to exit.
          my $error = check_signon( $comm_data, $d );
          if ($error) {
              $comm_data->{current_req} = last_command();
@@ -3797,9 +3805,10 @@
          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.
+    # 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} ) {
          print "No remaining processes, is job dead?\n";
          $comm_data->{current_req} = last_command();
@@ -3807,10 +3816,9 @@
          return;
      }

-    # We have received a reply to a request, send the next
-    # request first and then display this reply.  If in
-    # watch mode display the reply, sleep and then send
-    # the next request.
+    # We have received a reply to a request, send the next request first
+    # and then display this reply.  If in watch mode display the reply,
+    # sleep and then send the next request.
      my $req = next_command($comm_data);
      if ( not $watch ) {
          issue_command_to_inner( $cdata, $req );
@@ -3827,9 +3835,8 @@
      maybe_clear_screen();
      maybe_show_header($comm_data);

-    # Mode here is the mode for the reply we just got, this
-    # may not be the same thing as the request we are currently
-    # sending.
+    # Mode here is the mode for the reply we just got, this may not be the
+    # same thing as the request we are currently sending.
      my $mode = $comm_data->{current_req}->{mode};

      if ( defined $d->{target_data}{ERROR} ) {
@@ -3965,9 +3972,10 @@
   
###############################################################################

  # A common set of functions for dealing with (integer based) ranges.
-#
-# Internally a array format is used for speed, functions exist to convert  
from
-# the normal list format "[0-12,15,16]" to the internal one and back again.
+
+# Internally a array format is used for speed, functions exist to convert
+# from the normal list format "[0-12,15,16]" to the internal one and back
+# again.

  # rng_convert_from_user($userrange)
  # rc_convert_to_user($range)
@@ -4064,11 +4072,10 @@
      return $value;
  }

-# Note the performance of this function is much higher when adding
-# values at the top of the range than at the start, persumably it's
-# easier to make an array longer than it is to unshift something onto
-# the start.
-# Quietly return if the value is already in the range.
+# Note the performance of this function is much higher when adding values
+# at the top of the range than at the start, persumably it's easier to make
+# an array longer than it is to unshift something onto the start.  Quietly
+# return if the value is already in the range.
  sub rng_add_value {
      my ( $rg, $value ) = @_;

@@ -4110,9 +4117,9 @@
              return;
          } elsif ( $value == $u + 1 ) {

-            # If we meet the subsequent entry then merge the two.
-            # No need to check there is a subsequent entry here as
-            # that case has already been dealt with above.
+            # If we meet the subsequent entry then merge the two.  No need
+            # to check there is a subsequent entry here as that case has
+            # already been dealt with above.
              if ( $u + 2 == $rg->[ $idx + 1 ]->{l} ) {
                  $part->{u} = $rg->[ $idx + 1 ]->{u};
                  splice @{$rg}, $idx + 1, 1;
@@ -4136,8 +4143,8 @@
  sub rng_merge {
      my ( $rg, $new ) = @_;

-    # Need to use defined here as zero is a valid value to store
-    # in a range.
+    # Need to use defined here as zero is a valid value to store in a
+    # range.
      while ( defined( my $val = rng_shift($new) ) ) {
          rng_add_value( $rg, $val );
      }
@@ -4154,8 +4161,8 @@

      my $rng = rng_create_empty();

-    # Sort the array into numerical order so that the add_value calls
-    # can be fast.
+    # Sort the array into numerical order so that the add_value calls can
+    # be fast.

      foreach my $v ( sort { $a <=> $b } @r ) {
          rng_add_value( $rng, $v );
@@ -4366,8 +4373,8 @@

      $rem_jobid = $jobid;

-    # Setup whatever is needed for running parallel commands, note this  
might
-    # involve setting environment variables.
+    # Setup whatever is needed for running parallel commands, note this
+    # might involve setting environment variables.
      my ( $cmd, $ncpus, $hosts ) = setup_pcmd($jobid);

      $conf{verbose} && defined $ncpus && print "Job has $ncpus  
process(es)\n";
@@ -4574,11 +4581,9 @@

      print "Loading config from command line\n" if ( $conf{verbose} );

-    #
-    # Once again there is a 'bugette' here, you cant pass the
-    # first of these strings through due to the split hacking
-    # off everything to the right of the second equals sign
-    # however you can do the second.
+    # Once again there is a 'bugette' here, you cant pass the first of
+    # these strings through due to the split hacking off everything to the
+    # right of the second equals sign however you can do the second.
      # -Oedbopt="--pagesize=8192 --pagesize-header=4096"
      # -Oedbopt="--pagesize 8192 --pagesize-header 4096"
      foreach my $key ( keys %config_options ) {
@@ -4611,8 +4616,8 @@
          check_int( $conf{$co} );
      }

- # Now go through all the config options and both verify they are  
acceptable and
- # convert true/false strings to 1/0 values.
+    # Now go through all the config options and both verify they are
+    # acceptable and convert true/false strings to 1/0 values.
      foreach my $key ( keys %{ $conf{mode_options_reverse} } ) {
          foreach my $mode ( keys %{ $conf{mode_options_reverse}{$key} } ) {
              if ( defined $conf{options_verify}{$mode}{$key} ) {
@@ -4821,9 +4826,10 @@
   
###############################################################################

  # The code below here used to be in a separate script (padb-helper.pl) but
-# it's become apparent that for ease-of-distribution padb works better if  
it
-# is self-contained in one file.  Now we just have a big switch on ARGV[0]
-# and either run the inner or outer code depending on if it's set or not.
+# it's become apparent that for ease-of-distribution padb works better if
+# it is self-contained in one file.  Now we just have a big switch on
+# ARGV[0] and either run the inner or outer code depending on if it's set
+# or not.

  my %inner_conf;

@@ -4848,9 +4854,9 @@
      return;
  }

-# Report a single string error for a given target rank.
-# By convention (for now) this is called with UPPERCASE keys
-# for control/padb values and lowercase keys for mode values.
+# Report a single string error for a given target rank.  By convention (for
+# now) this is called with UPPERCASE keys for control/padb values and
+# lowercase keys for mode values.
  sub target_key_pair {
      my ( $rank, $key, $value ) = @_;

@@ -4873,9 +4879,11 @@
      return is_resmgr_process($parent_pid);
  }

-# This used to happen on ia64 when gdb segfaulted, I've not seen that for  
a number
-# of years however so lets try not doing it for a while and see where that  
gets us.
-#$SIG{PIPE} = 'IGNORE';
+# This used to happen on ia64 when gdb segfaulted, I've not seen that for a
+# number of years however so lets try not doing it for a while and see
+# where that gets us.
+
+# $SIG{PIPE} = 'IGNORE';

  sub gdb_start {
      my ( $exe, $core ) = @_;
@@ -4994,10 +5002,10 @@
  sub gdb_strip_first_quotes {
      my ($str) = @_;

-    # This is in part stolen from the "match a double-quoted string"  
section of
-    # http://perldoc.perl.org/perlre.html
+    # This is in part stolen from the "match a double-quoted string"
+    # section of http://perldoc.perl.org/perlre.html
      if (
-        $str =~ m{\A                   # Start of str.
+        $str =~ m{\A                    # Start of str.
                     "                    # Quote
                     ((?:[^"\\]++|\\.)*+) # Anyting which isn't \"
                     "                    # Close quote
@@ -5031,8 +5039,8 @@
      my $rem    = $str;
      my $indent = 0;

-    # Walk through the string matching [ and ] until the number
-    # of ] matches the number of [.
+    # Walk through the string matching [ and ] until the number of ]
+    # matches the number of [.
      while (
          $rem =~ m{\A          # Start of line.
                    ([^\[\]]*)  # Not a square brace.
@@ -5101,8 +5109,8 @@
      croak("Failed to extrace square braces from $str");
  }

-# Take a string (from gdb) and a optional field to "collapse on", return
-# a key, a value and a left-over string.  See comment and start of
+# Take a string (from gdb) and a optional field to "collapse on", return a
+# key, a value and a left-over string.  See comment and start of
  # gdb_parse_reason for documentation.
  sub gdb_new_parse {
      my ( $str, $collapse ) = @_;
@@ -5160,9 +5168,10 @@
***The diff for this file has been truncated for email.***




More information about the padb-devel mailing list