Description of problem: There is no information about order of condor_q parameters in manual page or help message. But "condor_q -long" output depends on position in parameters array. $ condor_q -- Submitter: : <:41399> : ID OWNER SUBMITTED RUN_TIME ST PRI SIZE CMD 175.0 condor 3/24 09:41 0+00:00:01 R 0 0.0 .condor_run.1349 $ /usr/bin/condor_q -long -format "%s\n" x -attributes ProcId,ExitCode,ExitBySignal,JobStatus 175 $ /usr/bin/condor_q -format "%s\n" x -long -attributes ProcId,ExitCode,ExitBySignal,JobStatus 175 ProcId = 0 ExitBySignal = FALSE JobStatus = 2 $ /usr/bin/condor_q -format "%s\n" x -attributes ProcId,ExitCode,ExitBySignal,JobStatus -long 175 ProcId = 0 ExitBySignal = FALSE JobStatus = 2 Version-Release number of selected component (if applicable): condor-7.4.5-0.7.el5 also condor-7.6.0-0.2.el5 How reproducible: 100% Steps to Reproduce: 1. submit job 2. try commands written above Actual results: output of condor_q depends on position of -long Expected results: output of condor_q will not depend on position of -long Additional info:
Also, $ condor_q -attributes ProcId,ExitCode,ExitBySignal,JobStatus -long -format "%s\n" x -long JobStatus = 5 ProcId = 0 ExitBySignal = false It looks like -format clears some -long bit. And indeed it does, src/condor_q.V6/queue.cpp if (match_prefix (arg, "long")) { verbose = 1; summarize = 0; } ... if( match_prefix( arg, "format" ) ) { // make sure we have at least two more arguments if( argc <= i+2 ) { fprintf( stderr, "Error: Argument -format requires " "format and attribute parameters\n" ); exit( 1 ); } verbose = 0;
It is unclear why the "verbose = 0" is important, especially when an extra -long after the -format can re-enable it. commit f57379da4ff5e9f2ea3920b6b71271a55ad341dc Author: gthain <gthain> Date: Thu Nov 15 21:06:57 2007 +0000 Add support for schedd-side projection when xml output is asked for. This is a bit of a hack, and only for Igor, so I am intentionall not documenting it yet diff --git a/src/condor_q.V6/queue.C b/src/condor_q.V6/queue.C index 3becaed..64fef7a 100644 --- a/src/condor_q.V6/queue.C +++ b/src/condor_q.V6/queue.C @@ -1122,6 +1122,7 @@ processCommandLineArguments (int argc, char *argv[]) "format and attribute parameters\n" ); exit( 1 ); } + verbose = 0; if (customFormat == false) { // first time here attrs.clearAll();
The code was introduced for the "-xml -format X Attr1 -format Y Attr2" trick, which is now explicitly supported with "-xml -attributes Attr1,Attr2". The importance of the "verbose = 0" is still a mystery and does not appear to be important in current code. It should just be removed.
upstream: https://condor-wiki.cs.wisc.edu/index.cgi/tktview?tn=2498
Committed to uw/V7_6-branch
REPRO/TEST Submit a more or less arbitrary job so there is something in the queue. Before fix, order of "-l" and "-format" will alter output: $ condor_q -attributes ProcId,JobStatus -l -format "%s\n" xxx 1 $ condor_q -attributes ProcId,JobStatus -format "%s\n" xxx -l 1 JobStatus = 2 ProcId = 0 After fix, order is independent: $ condor_q -attributes ProcId,JobStatus -l -format "%s\n" xxx 1 JobStatus = 2 ProcId = 0 $ condor_q -attributes ProcId,JobStatus -format "%s\n" xxx -l 1 JobStatus = 2 ProcId = 0
Technical note added. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. New Contents: Cause: boolean flag was needlessly reset during parsing of "-format" option on condor_q Consequence: Order dependency between "-long" and "-format" arguments on command line Fix: Removed the offending flag reset Result: "-long" and "-format" are no longer order dependent
Tested on RHEL5.8/RHEL6.1 x x86_64/i386 with condor-7.6.4-0.8 and it works -> VERIFIED
Technical note updated. If any revisions are required, please edit the "Technical Notes" field accordingly. All revisions will be proofread by the Engineering Content Services team. Diffed Contents: @@ -1,11 +1 @@ -Cause: +The "-long" and "-format" options to the condor_q command were order-dependent due to a parsing error. This update removes the parsing error, and the order of the aforementioned options no longer results in different behavior.-boolean flag was needlessly reset during parsing of "-format" option on condor_q - -Consequence: -Order dependency between "-long" and "-format" arguments on command line - -Fix: -Removed the offending flag reset - -Result: -"-long" and "-format" are no longer order dependent
Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. http://rhn.redhat.com/errata/RHEA-2012-0045.html