Selection Rules
Selection rules are used to create sets and to perform queries.
A selection rule consists of a list of predicates, separated by either spaces or
logical operators. A non-quoted, non-escaped space between predicates is equivalent
to an AND operator. Parentheses may be used to group logical operations or
manipulate precedence. Each predicate typically consists of three parts:
- The name of the field, which is required. The name of the field is case-insensitive and may contain extra underscores. For example, ISJOB, IsJob and is_job are all legal names for the field ISJOB.
- An operator on the field. Refer to the list of Operators.
- A value. This part is interpreted as an integer for boolean and integer fields, or as a string for string fields. The value may contain spaces or other special characters if it is enclosed in double quotes (see Examples of Selection Rules, below). Spaces in a value may also be entered if they are preceded by a backslash ("\") character. Operator and value can be omitted, in which case they default to !=0 for numeric fields and !="" for string fields.
A special case is also supported where the name of a field can be passed by itself. This will query for objects that contain the field, and where the field's value is non-zero (for numeric fields) or non-empty (for string fields).
Supported logical operations are AND, OR and NOT. In the absence of parentheses, AND
operations will always take precedence over OR operations at the same level. For
example, the
expression:
idint<5000 | idint>10000 & isjob
is evaluated as:
idint<5000 | (idint>10000 & isjob)
which may not be what was intended. To make sure the isjob
predicate applies to the entire rule, use parentheses to group the predicates
explicitly:
(idint<5000 | idint>10000) & isjob
When selecting multiple values from a single field, comma-separated lists of values
are supported. For example to select all INVALID and FAILED jobs, the selection rule
can be written as:
isjob & status==FAILED,INVALID
This rule
is equivalent
to:isjob & (status==FAILED | status==INVALID)
Note: Commas used in regular expressions, that is, with the ~, ^ or : operators, will be
interpreted as separators in a list of regular expressions. For example, the rule
isjob status~A,B
will match any job with "A" or "B" in its
status field and does NOT attempt to match the string "A,B". If you wish to use a
comma in a regular expression, enclose the expression in quotes. In this example you
would use isjob status~"A,B"
. Selection rules that accept integer values will also accept timespecs; for example
"isjob autokill>10m
" would select all jobs with an autokill set
to greater than 10 minutes.
Examples of Selection Rules
Selection Rule | Explanation |
---|---|
isjob==1 |
Select all jobs |
isjob |
Select all jobs (equivalent to
"isjob!=0 ") |
!isjob |
Select everything except jobs (equivalent to
"isjob!=0 ") |
not isjob |
Select everything except jobs (equivalent to
"isjob!=0 ") |
IS_FILE and db!=FILE |
Select all files which are not in the database
FILE |
status==RUNNING |
Select all nodes whose status is RUNNING |
status==RUNNING,VALID |
Select all nodes whose status is RUNNING or VALID |
status!=RUNNING,VALID |
Select all nodes whose status is neither RUNNING nor VALID |
status!=RUNNING and status!=VALID |
Select all nodes whose status is neither RUNNING nor VALID |
isjob status==INVALID |
Select all invalid jobs |
isjob duration>300 |
Select all jobs that have lasted more than 5 minutes (i.e. 300 seconds). |
isjob command~~aa |
Select all jobs with a command line containing the string
aa ; the ~~ operator is used for case
insensitive match. |
isjob age<600 |
Select all jobs completed less than 10 minutes ago. |
isjob & age<600 |
Select all jobs completed less than 10 minutes ago. |
isjob AND age<600 |
Select all jobs completed less than 10 minutes ago. |
isfile name~ccc |
Select all files with name containing ccc .
|
isjob inputs<2 status==INVALID |
Select all jobs that have fewer than 2 inputs and are invalid. |
isjob AND (inputs<2 OR
status==INVALID) |
Select all jobs that have fewer than 2 inputs or are invalid. |
isjob (inputs<2 |
status==INVALID) |
Select all jobs that have fewer than 2 inputs or are invalid. |
isjob inputs<2 | status==INVALID |
Select all jobs that have fewer than 2 inputs, and all nodes (including non-jobs) that are invalid. See notes on AND/OR precedence, above. |
isfile status==VALID age>=600
name~xxx |
Select all valid files older than 10 minutes whose name
contains the string xxx . |
isfile status==VALID age>=10m
name~xxx |
Select all valid files older than 10 minutes whose name
contains the string xxx . |
isjob tool==gcc resources~diskio
duration>10 |
Select all jobs that use the tool gcc and require the resource diskio and take more than 10 seconds. |
isjob status~A,D |
Select all jobs that have either "A" or "D" in their Status fields; see notes on commas in regular expressions, above. |
isjob & status~"A,D" |
Select all jobs that have the string "A,D" in their Status fields. |
isjob & status~[A-Z]+A[A-Z]+D |
Select all jobs that match the regular expression "[A-Z]+A[A-Z]+D" in their Status fields (e.g. FAILED, INVALID). |
isjob status::inv* |
Select all jobs whose status fields start with "inv" (case-insensitive). |
isjob and status:inv* |
Select all jobs whose status fields start with "inv" (case-sensitive). |
isjob status!::inv* |
Select all jobs whose status fields do not start with "inv" (case-insensitive). |
isjob AND command!^"sleep 60" |
Select all jobs whose commands do not contain the string "sleep 60" (case-sensitive). Note that spaces are allowed in quoted values. |
isjob AND command!^^sleep\ 60 |
Select all jobs whose commands do not contain the string "sleep 60" (case-insensitive). Note that spaces are allowed if preceded by a backslash ("\"). |
Selection Rules and Incompatible Fields
A predicate based on an incompatible field is always true. Thus, the effect of the
rule
isjob name~xxx
is to select all jobs in the trace, because the
predicate isjob
is true for jobs and false for files, while the
predicate name~xxx
is true for all jobs because the field
"NAME" is incompatible for jobs.Note: The flag for skip is
actually named
autoflow
. For example:
# Look for skipped jobs
isjob ISAUTOFLOW==1