Monday, June 27, 2011

How To Write a Condor_q Wrapper



You may want to write a condor_q wrapper to display information specific to your installation. With condor_q's -format option, this is usually straightforward. Each call to -format allows you to write one piece of information. That information can be simple attributes from the job's ClassAd, or it can be full ClassAd expressions.

Note that all of this applies to condor_status as well.


Here is a a command that almost replicates the output of "condor_q". It does not print the "-- Submitter:" line at the start, nor does it print the summary at the bottom. Furthermore, condor_q truncates the Cmd name to just the executable itself, excluding the directory portion of the path. If #1368 is implemented, extracting just the executable will be relatively straightforward.


 








condor_q 
-format '%4d.' ClusterId
-format '%-3d ' ProcId
-format '%-14s ' Owner
-format '%-11s ' 'formatTime(QDate,"%m/%d %H:%M")'
-format '%3d+' 'int(RemoteUserCpu/(60*60*24))'
-format '%02d:' 'int((RemoteUserCpu-(int(RemoteUserCpu/(60*60*24))*60*60*24))/(60*60))'
-format '%02d:' 'int((RemoteUserCpu-(int(RemoteUserCpu/(60*60))*60*60))/(60))'
-format '%02d ' 'int(RemoteUserCpu-(int(RemoteUserCpu/60)*60))'
-format '%-2s ' 'ifThenElse(JobStatus==0,"U",ifThenElse(JobStatus==1,"I",ifThenElse(JobStatus==2,"R",ifThenElse(JobStatus==3,"X",ifThenElse(JobStatus==4,"C",ifThenElse(JobStatus==5,"H",ifThenElse(JobStatus==6,"E",string(JobStatus))))))))'
-format '%-3d ' JobPrio
-format '%-4.1f ' ImageSize/1024.0
-format '%-18.18s' 'strcat(Cmd," ",Arguments)'
-format 'n' Owner








(The RUN_TIME formatting is complicated because 7.4.x and earlier ClassAds lack the modulus (%) operator. 7.5.2 and later will likely include this operator along with "New ClassAds", allowing for simpler expressions. The ST formatting might be simplified if #1369 or something similar is implemented, but that is uncertain.)





Very useful in order to get exactly the information you want from condor_q. In my particular case, I wanted to see the full line of arguments passed to the executable. For this I change the last 3 lines of the command above to:



-format '%-4.1fn ' ImageSize/1024.0  
-format '%s' Args  
-format 'n' Owner



No comments:

Post a Comment