[torquedev] set_resource() bug

David Singleton David.Singleton at anu.edu.au
Sun Nov 26 20:13:40 MST 2006


According to the qsub man page, command line args should
override script directives.  However with both OpenPBS and
torque the following violates that (the queued job has a
nodes request of 4):

 > qsub -h -N junk -lnodes=2
#PBS -lnodes=4
#PBS -lwalltime=1:00
w
^D

Seeing the bug requires an odd set of circumstances (command line
-N, conflicting resource requests at the end of command line args
and start of script directives, ...).

Here's a hacky fix for OpenPBS.  I think the torque code is just
a reformatting of this:


--- PBS/OpenPBS_2_3_12/src/lib/Libcmds/set_resource.c   2000-08-09 10:17:21.000000000 +1000
+++ ./set_resource.c    2006-11-27 13:54:48.000000000 +1100
@@ -200,14 +200,16 @@
          if ( *attrib == NULL ) {
             *attrib = attr;
          } else {
+           struct attrl *prev = NULL;
             ap = *attrib;
             found = FALSE;
-           while ( ap->next != NULL ) {
+           while ( ap != NULL ) {
                 if ( strcmp(ap->name, ATTR_l) == 0 &&
                      strcmp(ap->resource, attr->resource) == 0 ) found = TRUE;
+               prev = ap;
                 ap = ap->next;
             }
-           if ( add || !found ) ap->next = attr;
+           if ( add || !found ) prev->next = attr;
          }

         /* Get ready for next resource/value pair */


I think set_resource() was modelled on set_attr() which is a simpler case,
it's just looking for the last element in the attrib list.

David




More information about the torquedev mailing list