[padb] Réf. : Re: Réf. : Re: Réf. : Re: Réf. : Re: [padb-devel] Patch for Support of PBS Pro resource manager

Ashley Pittman ashley at pittman.co.uk
Wed Nov 25 18:51:23 GMT 2009


On Wed, 2009-11-25 at 11:15 +0100, thipadin.seng-long at bull.net wrote:
> 
> Thanks you to accept to commit. 

How does the following look to you?  nproc is only ever set once so it
can be stored as a value rather than a array with only one entry which
simplifies the code slightly.  I would just commit it from here but
without access to a pbs system I can't test it.

Re: coding standards take a look at the 'tidy' and 'report' make
targets, I try and ensure my code has as few errors as reported by
perlcritic as possible.  This isn't always easy but is worth doing now
and again.  I also try and avoid implicitly using $_ where-ever possible
as it tends to make the code easier to read.

ashley at alpha:~/code/padb/trunk/src$ svn diff
Index: padb
===================================================================
--- padb	(revision 338)
+++ padb	(working copy)
@@ -2662,8 +2662,7 @@
             my @champs = split(/\s+/);    # split by space
             if ( $champs[9] eq 'R' ) {    # take only Running
                 ($job) = split qr{\.}, $champs[0];
-                $nprocess = $champs[6];
-                push( @{ $pbs_tabjobs{$job}{nproc} }, $nprocess );
+                $pbs_tabjobs{$job}{nproc} = $champs[6];
             } else {
                 $job = undef;
             }
@@ -2732,15 +2731,13 @@
     my $job = shift;
     my $d   = pbs_get_data($target_user);
 
-    my @hosts  = @{ $d->{$job}{hosts} };
-    my @nprocs = @{ $d->{$job}{nproc} };
-    my $nprocs = $nprocs[0];
+    my @hosts = @{ $d->{$job}{hosts} };
 
     config_set_internal( 'pbs_server', $d->{$job}{server} );
 
     my %pcmd;
 
-    $pcmd{nprocesses} = $nprocs;
+    $pcmd{nprocesses} = $d->{$job}{nproc};
     $pcmd{nhosts}     = @hosts;
     @{ $pcmd{host_list} } = @hosts;
 


-- 

Ashley Pittman, Bath, UK.

Padb - A parallel job inspection tool for cluster computing
http://padb.pittman.org.uk





More information about the padb-devel mailing list