Page History
- 2017-May-03 14:06 tannenba
- 2017-Feb-15 10:12 johnkn
- 2016-Dec-09 12:10 johnkn
- 2016-May-19 15:38 johnkn
- 2016-May-19 15:34 johnkn
- 2016-May-19 15:34 johnkn
- 2016-May-19 15:31 johnkn
- 2015-May-06 15:24 johnkn
- 2015-Apr-30 13:55 johnkn
- 2015-Apr-23 14:46 johnkn
- 2015-Apr-07 16:05 johnkn
- 2014-May-15 16:31 johnkn
- 2014-May-15 15:46 johnkn
- 2014-May-15 11:57 johnkn
- 2014-May-15 11:56 johnkn
- 2014-May-15 11:24 johnkn
the contains of <file> has the following syntax syntax is
SELECT [BARE | NOTITLE | NOHEADER | NOSUMMARY] [LABEL] [SEPARATOR <string>] [RECORDPREFIX <string>] [FIELDPREFIX <string>] [FIELDSUFFIX <string>]
    <expr> [AS <string>] [PRINTF <format-string> | PRINTAS <function-name> | WIDTH [AUTO | [-]<INT>] ] [TRUNCATE] [LEFT | RIGHT] [NOPREFIX] [NOSUFFIX]
    ... repeat the above line as needed...
[WHERE <constraint-expr>]
[GROUP BY <sort-expr> [ASCENDING | DECENDING] ]
[SUMMARY [STANDARD | NONE]]
- Lines beginning with # are comments
- escapes such as \n and \t are translated for most <string> arguments.
- <strings> may be wrapped in " or ', but can't contain imbedded quotes of the same type as the outer quote, (the parser currently doesn't support escaping of quotes).
- if no quotes are used around <string> arguments, the first whitespace ends the argument.
- statements end at a newline, there is no line-continuation character. <expr> arguments may be wrapped in quotes like strings with the same rules applying regarding nested strings.
- GROUP BYcurrently only controls sorting, the code does not yet do any kind of aggregating.
- PRINTAS,- PRINTF&- WIDTHare not entirely mutually exclusive, but more than one will play strangely together, there's actually a bunch of "intelligence" in the pretty printer code regarding the correct way to format strings vs numbers that's not desirable here but can't be disabled, you may need to play with combinations of formatting options to get things to line up perfectly. for instance negative WIDTH statements and the LEFT keyword should be interchangeable, but they aren't at present. Available keywords for PRINTAS can be found only in the code. search for CustomFormatFnTable, you should find one table in queue.cpp and one in prettyPrint.cpp (for condor_status).
- be aware that many PRINTAS functions are very special case and pay little or no attention to the attribute that they are told to print.
Here are some examples
    # produce the standard output of condor_q
    SELECT
       ClusterId     AS " ID"  NOSUFFIX WIDTH 4
       ProcId        AS " "    NOPREFIX             PRINTF ".%-3d"
       Owner         AS "OWNER"         WIDTH -14   PRINTAS OWNER
       QDate         AS "  SUBMITTED"   WIDTH 11    PRINTAS QDATE
       RemoteUserCpu AS "    RUN_TIME"  WIDTH 12    PRINTAS CPU_TIME
       JobStatus     AS ST                          PRINTAS JOB_STATUS
       JobPrio       AS PRI
       ImageSize     AS SIZE            WIDTH 4     PRINTAS MEMORY_USAGE
       Cmd           AS CMD             WIDTH -18   PRINTAS JOB_DESCRIPTION
    SUMMARY STANDARD
    # produce the standard output of condor_status
    SELECT
       Name       AS Name     WIDTH -18 TRUNCATE
       OpSys      AS OpSys    WIDTH -10
       Arch       AS Arch     WIDTH -6
       State      AS State    WIDTH -9
       Activity   AS Activity WIDTH -8  TRUNCATE
       LoadAvg    AS LoadAv             PRINTAS LOAD_AVG
       Memory     AS Mem                PRINTF "%4d"
       EnteredCurrentActivity AS "  ActvtyTime\n" NOPREFIX PRINTAS ACTIVITY_TIME
    SUMMARY STANDARD
    # modified default condor_status output designed to show blackholes
    SELECT
       Machine WIDTH -24
       splitslotname(Name)[0] AS Slot WIDTH -8
       Strcat(Arch,"_",IfThenElse(OpSys=="WINDOWS",OpSysShortName,OpSysName)) AS Platform
       Cpus AS CPU
       Memory     PRINTF "%6d"     AS Mem
       Strcat(State,"/",Activity) AS Status WIDTH -14 TRUNCATE
       EnteredCurrentActivity AS "  StatusTime"  PRINTAS ACTIVITY_TIME NOPREFIX
       IfThenElse(JobId isnt undefined, JobId, "no") AS JobId WIDTH -11
       RecentJobStarts/20.0 AS J/Min PRINTF "%.2f"
    WHERE RecentJobStarts >= 1 && PartitionableSlot =!= true && DynamicSlot =!= true
    SUMMARY
    # condor_status query for slot pairs, use with condor_status -direct to see hidden pairs.
    SELECT
       # Machine WIDTH AUTO
       splitslotname(Name)[0] AS SlotName WIDTH -8
       IfThenElse(SlotPairName isnt undefined,splitslotname(SlotPairName)[0],"-") AS Paired
       Strcat(Arch,"_",IfThenElse(OpSys=="WINDOWS",OpSysShortName,OpSysAndVer)) AS Platform
       Cpus AS Cpus PRINTF "%.3f"
       # IfThenElse(GPUs isnt undefined,GPUs,0) AS GPUs PRINTF "%4d"
       Memory WIDTH 6
       Disk       WIDTH 8
       EnteredCurrentActivity AS "  StatusTime"  PRINTAS ACTIVITY_TIME NOPREFIX
       Strcat(State,"/",Activity) AS Status WIDTH -14 TRUNCATE
       ifthenelse(JobId isnt undefined, JobId, "") AS JobID
    #   unparse(IsOwner) AS ISOWNER
       unparse(start) AS START
    #   unparse(requirements) AS Requirements
    # show only totals with condor_q
    SELECT NOHEADER NOTITLE
    SUMMARY STANDARD
    # STARTD output in compact long format
    SELECT RECORDPREFIX "\t***\n" RECORDSUFFIX "\n\n" FIELDPREFIX "\n" NOHEADER LABEL SEPARATOR "\t: "
    Machine AS "Machine\t"
    splitslotname(Name)[0] AS "Slot\t"
    strcat(Arch,"_",IfThenElse(OpSys=="WINDOWS",OpSysName,OpSysAndVer)) AS Platform
    strcat(State,"/",Activity) AS "State\t"
    EnteredCurrentActivity AS StateTime PRINTAS ACTIVITY_TIME PRINTF "%s"
    Cpus AS "Cpus\t"
    Memory AS "Memory\t"
    Disk   AS "Disk\t"
