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

Toni L. Harbaugh-Blackford [Contr] harbaugh at ncifcrf.gov
Thu Feb 1 04:29:41 MST 2007


Dave:

On Thu, 1 Feb 2007, David B Jackson wrote:

  > Toni,
  >
  >   Although the current usage of TORQUE does not fully take advantage of
  > flexible resource nesting, I believe upcoming versions will.
  > Consequently, the nested XML approach will probably be the best
  > solution.  Please send this patch at your convenience.
  >

Below is the xml-child version of the patch.

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-02-01 05:53:22.000000000 -0500
@@ -954,6 +954,7 @@
   mxml_t *DE;
   mxml_t *JE;
   mxml_t *AE;
+  mxml_t *RE1;

   /* XML only support for full output */

@@ -1016,6 +1017,7 @@

       a = p->attribs;

+      RE1 = NULL;
       while (a != NULL)
         {
         if (a->name != NULL)
@@ -1025,12 +1027,24 @@
             /* lookup a->name -> XML attr name */

             AE = NULL;
-
-            MXMLCreateE(&AE,a->name);
-
-            MXMLSetVal(AE,a->value);
-
-            MXMLAddE(JE,AE);
+            if (a->resource != NULL)
+              {
+              if (RE1 == NULL)
+                {
+                MXMLCreateE(&RE1,a->name);
+                MXMLAddE(JE,RE1);
+                }
+              MXMLCreateE(&AE,a->resource);
+              MXMLSetVal(AE,a->value);
+              MXMLAddE(RE1,AE);
+              }
+            else
+              {
+              RE1 = NULL;
+              MXMLCreateE(&AE,a->name);
+              MXMLSetVal(AE,a->value);
+              MXMLAddE(JE,AE);
+              }
             }
           else
             {
-------------------------------------------------------------------
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