Bug 580530 - Missing reason for error message when condor_history given constraint and cluster or job id
Summary: Missing reason for error message when condor_history given constraint and clu...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise MRG
Classification: Red Hat
Component: condor
Version: 1.0
Hardware: All
OS: Linux
low
medium
Target Milestone: 2.0
: ---
Assignee: Matthew Farrellee
QA Contact: Tomas Rusnak
URL:
Whiteboard:
Depends On:
Blocks: 693778
TreeView+ depends on / blocked
 
Reported: 2010-04-08 13:32 UTC by Martin Kudlej
Modified: 2011-06-23 15:41 UTC (History)
4 users (show)

Fixed In Version: condor-7.5.6-0.1
Doc Type: Bug Fix
Doc Text:
C: Mixing -constraint and a restriction list displayed only usage information C: No hint as to what went wrong, users could be confused F: An error is printed when -constraint and a restriction list are encountered R: Mixing -constraint and a restriction list now reports an error and usage
Clone Of:
Environment:
Last Closed: 2011-06-23 15:41:05 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHEA-2011:0889 0 normal SHIPPED_LIVE Red Hat Enterprise MRG Grid 2.0 Release 2011-06-23 15:35:53 UTC

Description Martin Kudlej 2010-04-08 13:32:16 UTC
Description of problem:
Command

condor_history -constraint "GlobalJobId==\"machine#1.0#1270718103\"" 1.0

gets help message instead of error message.

Version-Release number of selected component (if applicable):
condor-7.4.3-0.8.el5

How reproducible:
100%

Comment 1 Matthew Farrellee 2011-01-07 19:41:41 UTC
Broken...

$ ./condor_history -match 1 -const TRUE     
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   

$ ./condor_history -match 1 1.0        
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   

$ ./condor_history -match 1 -const TRUE 1.0
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>

$ ./condor_history -match 1 -const TRUE 1  
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>

$ ./condor_history -match 1 -const TRUE matt
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>

Comment 2 Matthew Farrellee 2011-01-07 19:42:36 UTC
Not broken...

$ ./condor_history -match 1 -const TRUE ; echo $?
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   
0

$ ./condor_history -match 1 1.0 ; echo $?   
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   
0

$ ./condor_history -match 1 1 ; echo $? 
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   
0

$ ./condor_history -match 1 matt ; echo $?
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   matt            9/24 15:28   0+00:00:02 C   9/24 15:29 /bin/sleep 1   
0

$ ./condor_history -match 1 -const TRUE 1.0 ; echo $? 
Error: Cannot provide both -constraint and <cluster>.<proc>
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>
1

$ ./condor_history -match 1 -const TRUE 1 ; echo $?  
Error: Cannot provide both -constraint and <cluster>
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>
1

$ ./condor_history -match 1 -const TRUE matt ; echo $?
Error: Cannot provide both -constraint and <owner>
Usage: ./condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>
1

Comment 3 Matthew Farrellee 2011-01-07 19:43:08 UTC
A patch...

diff --git a/src/condor_tools/history.cpp b/src/condor_tools/history.cpp
index c9d5833..8241172 100644
--- a/src/condor_tools/history.cpp
+++ b/src/condor_tools/history.cpp
@@ -254,7 +254,10 @@ main(int argc, char* argv[])
 #endif /* HAVE_EXT_POSTGRESQL */
 
     else if (sscanf (argv[i], "%d.%d", &cluster, &proc) == 2) {
-     if (constraint) break;
+     if (constraint) {
+        fprintf(stderr, "Error: Cannot provide both -constraint and <cluster>.<proc>\n");
+        break;
+     }
      sprintf (tmp, "((%s == %d) && (%s == %d))", 
             ATTR_CLUSTER_ID, cluster,ATTR_PROC_ID, proc);
      constraint=tmp;
@@ -266,7 +269,10 @@ main(int argc, char* argv[])
 #endif /* HAVE_EXT_POSTGRESQL */
     }
     else if (sscanf (argv[i], "%d", &cluster) == 1) {
-     if (constraint) break;
+     if (constraint) {
+        fprintf(stderr, "Error: Cannot provide both -constraint and <cluster>\n");
+        break;
+     }
      sprintf (tmp, "(%s == %d)", ATTR_CLUSTER_ID, cluster);
      constraint=tmp;
      parameters[0] = &cluster;
@@ -281,7 +287,10 @@ main(int argc, char* argv[])
           dprintf_config ("TOOL");
     }
     else {
-     if (constraint) break;
+     if (constraint) {
+        fprintf(stderr, "Error: Cannot provide both -constraint and <owner>\n");
+        break;
+     }
      owner = (char *) malloc(512 * sizeof(char));
      sscanf(argv[i], "%s", owner); 
      sprintf(tmp, "(%s == \"%s\")", ATTR_OWNER, owner);

Comment 4 Matthew Farrellee 2011-01-07 19:55:44 UTC
Fixed upstream for 7.6 in https://condor-wiki.cs.wisc.edu/index.cgi/tktview?tn=1843

Comment 5 Matthew Farrellee 2011-01-07 19:55:44 UTC
    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:
C: Mixing -constraint and a restriction list displayed only usage information
C: No hint as to what went wrong, users could be confused
F: An error is printed when -constraint and a restriction list are encountered
R: Mixing -constraint and a restriction list now reports an error and usage

Comment 7 Tomas Rusnak 2011-05-30 14:56:44 UTC
Retested over all supported platforms RHEL5,RHEL6/x86,x86_64 with:

condor-7.6.1-0.6

# condor_history -match 1 -const TRUE ; echo $?
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   test            5/4  13:12   0+00:00:22 C   5/4  13:13 /bin/sleep 20  
0
# condor_history -match 1 1.0 ; echo $?   
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   test            5/4  13:12   0+00:00:22 C   5/4  13:13 /bin/sleep 20  
0
# condor_history -match 1 1 ; echo $? 
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
   1.0   test            5/4  13:12   0+00:00:22 C   5/4  13:13 /bin/sleep 20  
0
# condor_history -match 1 matt ; echo $?
 ID      OWNER            SUBMITTED     RUN_TIME ST   COMPLETED CMD            
0


# condor_history -match 1 -const TRUE 1.0 ; echo $? 
Error: Cannot provide both -constraint and <cluster>.<proc>
Usage: condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>
1
# condor_history -match 1 -const TRUE 1 ; echo $?  
Error: Cannot provide both -constraint and <cluster>
Usage: condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>
1
# condor_history -match 1 -const TRUE matt ; echo $?
Error: Cannot provide both -constraint and <owner>
Usage: condor_history [options]
	where [options] are
		-help			This screen
		-f <file>		Read history data from specified file
		-backwards		List jobs in reverse chronological order
		-match <number>		Limit the number of jobs displayed
		-format <fmt> <attr>	Print attribute attr using format fmt
		-l			Verbose output (entire classads)
		-constraint <expr>	Add constraint on classads
		restriction list
	where each restriction may be one of
		<cluster>		Get information about specific cluster
		<cluster>.<proc>	Get information about specific job
		<owner>			Information about jobs owned by <owner>

Mixing of parameters is now handled correctly, 

>>> VERIFIED

Comment 8 errata-xmlrpc 2011-06-23 15:41:05 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHEA-2011-0889.html


Note You need to log in before you can comment on or make changes to this bug.