[torquedev] patch: fix qstat xml output of Resource_List and resources_used

Toni L. Harbaugh-Blackford [Contr] harbaugh at abcc.ncifcrf.gov
Tue Jan 30 16:39:42 MST 2007


Hi-

qstat -x leaves out the subfields when printing the XML of Resource_List
and resources_used.  For instance,

  Resource_List.ncpus = 2

is printed in XML as

  <Resource_List>2</Resource_List>

Below is a simple patch which will append the subfield with a "." as
in the plain text output, so the XML will come out as

  <Resource_List.ncpus>2</Resource_List.ncpus>

I have another patch that will instead make the subfields XML children, if
you would prefer that.

Thanks,
Toni

--- torque-2.2.0-snap.200611291634/src/cmds/qstat.c_orig	2006-11-07 20:34:15.000000000 -0500
+++ torque-2.2.0-snap.200611291634/src/cmds/qstat.c     	2007-01-30 05:25:14.000000000 -0500
@@ -950,6 +950,7 @@
   char format[80];
   char long_name[17];
   time_t epoch;
+  char combined[80];

   mxml_t *DE;
   mxml_t *JE;
@@ -1025,8 +1026,17 @@
             /* lookup a->name -> XML attr name */

             AE = NULL;
-
-            MXMLCreateE(&AE,a->name);
+            if (!strcmp(a->name,ATTR_l) ||
+                !strcmp(a->name,ATTR_used)) {
+              combined[0]=0;
+              strcat(combined,a->name);
+              strcat(combined,".");
+              strcat(combined,a->resource);
+              MXMLCreateE(&AE,combined);
+            }
+            else {
+              MXMLCreateE(&AE,a->name);
+            }

             MXMLSetVal(AE,a->value);


-------------------------------------------------------------------
Toni Harbaugh-Blackford                   harbaugh at abcc.ncifcrf.gov
System Administrator
Advanced Biomedical Computing Center (ABCC)
National Cancer Institute
Contractor - SAIC/Frederick


More information about the torquedev mailing list