[torqueusers] qstat patch

Jerry Smith jdsmit at sandia.gov
Thu Nov 3 11:25:05 MST 2005


All,

Not sure how many of you have run into this problem, but we have a 
pbs_server with a name that exceeds the length available for output in 
qstat ( as well as jobID would be reported differently for qstat/qstat 
-a/qstat -r , making scripting a bit tricky ).  I added some space to 
this and a little more  for jobIds that push into the 6 digit range as 
well.  The output for nodect as well was limited to 3 digits, I upped 
this to 5 places, because job requests of 1000+ nodes showed up as 100.  
This patch works for 1.2.0p6 and 2.0.0.



Jerry Smith
-------------------------------
Sandia National Laboratories

-------------- next part --------------
diff -Naur torque-2.0.0p0/src/cmds/qstat.c torque-2.0.0p0.new/src/cmds/qstat.c
--- torque-2.0.0p0/src/cmds/qstat.c	2005-10-18 10:36:30.000000000 -0600
+++ torque-2.0.0p0.new/src/cmds/qstat.c	2005-11-03 08:22:02.000000000 -0700
@@ -560,19 +560,19 @@
 
     if (alt_opt & ALT_DISPLAY_R) 
       {
-      printf("\n                                          Req'd  Req'd   Elap \n");
+      printf("\n                                             Req'd  Req'd   Elap \n");
 
-      printf("Job ID          Username Queue    NDS TSK Memory Time  S Time   BIG  FAST   PFS\n");
+      printf("Job ID              Username Queue    NDS TSK Memory Time  S Time   BIG  FAST   PFS\n");
 
-      printf("--------------- -------- -------- --- --- ------ ----- - ----- ----- ----- -----\n"); 
+      printf("------------------   -------- -------- --- --- ------ ----- - ----- ----- ----- -----\n"); 
       } 
     else 
       {
-      printf("\n                                                            Req'd  Req'd   Elap\n");
+      printf("\n                                                                   Req'd Req'd    Elap\n");
 
-      printf("Job ID          Username Queue    Jobname    SessID NDS TSK Memory Time  S Time\n");
+      printf("Job ID               Username Queue    Jobname      SessID NDS TSK Memory  Time  S Time\n");
 
-      printf("--------------- -------- -------- ---------- ------ --- --- ------ ----- - -----\n");
+      printf("------------------   -------- -------- ----------   ------ --- --- ------ ----- - -----\n");
       }
     }
 
@@ -670,24 +670,24 @@
 		}
 
 
-		printf("%-15.15s %-8.8s %-8.8s ", 
+		printf("%-20.20s %-8.8s %-8.8s ", 
 			pstat->name, usern, queuen);
 		if (alt_opt & ALT_DISPLAY_R) {
-			printf("%3.3s %3.3s %6.6s %5.5s %1.1s %5.5s %5.5s %5.5s %5.5s\n", 
+			printf("%5.5s %3.3s %6.6s %5.5s %1.1s %5.5s %5.5s %5.5s %5.5s\n", 
 				nodect, tasks, rqmem, 
 				usecput ? rqtimecpu : rqtimewal,
 				jstate, 
 				usecput ? eltimecpu : eltimewal,
 				srfsbig, srfsfast, pfs);
 		} else {
-			printf("%-10.10s %6.6s %3.3s %3.3s %6.6s %5.5s %1.1s %5.5s\n",
+			printf("%-10.10s %6.6s %5.5s %3.3s %6.6s %5.5s %1.1s %5.5s\n",
 				jobn, sess, nodect, tasks, 
 				rqmem,
 				usecput ? rqtimecpu : rqtimewal,
 				jstate, 
 				usecput ? eltimecpu : eltimewal);
 		}
-
+ 
 		if (alt_opt & ALT_DISPLAY_n) {
 			/* print assigned nodes */
 			prt_nodes(exechost);
@@ -808,7 +808,7 @@
 			pat = pat->next;
 		}
 
-		printf("%-16.16s %6.6s %8.8s %8.8s %4.4s ",
+		printf("%-16.16s %6.6s %8.8s %8.8s %5.5s ",
 		       pstat->name, rmem, cput, wallt, nodect);
 		printf("%3d %3d %2.2s   %c %c\n",
 		       jrun, jque, jmax, qenabled, qstarted);
@@ -900,8 +900,8 @@
       {
       /* display summary header */
 
-      printf("Job id           Name             User             Time Use S Queue\n");
-      printf("---------------- ---------------- ---------------- -------- - -----\n");
+      printf("Job id              Name             User             Time Use S Queue\n");
+      printf("------------------  ---------------- ---------------- -------- - -----\n");
       }
     }    /* END if (!full) */
 
@@ -996,7 +996,7 @@
                 *c = '\0';
                 l = strlen(p->name);
                 if ( l > (PBS_MAXSEQNUM+8) ) {
-                    c = p->name + PBS_MAXSEQNUM + 8;
+                    c = p->name + PBS_MAXSEQNUM + 14;
                     *c = '\0';
                 }
                 jid = p->name;


More information about the torqueusers mailing list