Qube's requirement specification is expression based. The proper use of these expressions will allow a user to specify the host and/or the conditions required before a job is allowed to run.
The syntax for specifying the expression is similar to Perl or C. The evaluation of the expression where:
<expression> == true
allows the job to be dispatched to a qualifying host. An expression consists of operators and operands. Operators are either text or symbolic.
These are equivalent:
eq, ==, =
String and numeric comparisons are automatically resolved based upon the values they resolve to.
Quoting
Since a job requirement can include a number of operator characters, any reference to a property or resource that includes an operator should be quoted so the interpreter can differentiate between the literal character and the operator.
Example
qbsub --requirements "host.kernel_version eq '2.6.17-1.2142_FC4smp'"
Operators
Operator | Definition | Expression | Result |
---|---|---|---|
min | minimum | 10 min 12 | 10 |
max | maximum | 10 max 12 | 12 |
sub, - | subtract | 10 sub 8 | 2 |
add, + | addition | 1 + 2 | 3 |
mul, * | multiplication | 3 * 4 | 12 |
div, / | division | 14 / 7 | 2 |
xor, ^ | XOR | 12 xor 8 | 4 |
mod, % | modulus | 10 % 4 | 2 |
in | value in list (string with commas) | "v" in "x,y,v" | true |
has | list (string with commas) has value | "x,y,v" has "v" | true |
not, ! | NOT | not 1 | false |
eq, =, == | equal | 10 == 10 | true |
ne, <>, != | NOT equal | 10 != 10 | false |
and, && | AND | 1 and 0 | false |
or, | OR | 1 or 0 | true |
& | bitwise AND | 12 & 8 | 8 |
bitwise OR | 8 & 4 | 12 | |
lt, < | less than | 5 < 10 | true |
gt, > | greater than | 5 > 10 | false |
le, <= | less than or equal | 4 >= 6 | false |
ge, >= | greater than or equal | 4 <= 6 | true |
rs, >> | bitwise right shift (used to divide by 2n) | 4 >> 1 | 2 |
ls, << | bitwise left shift (used to multiply by 2n) | 4 << 1 | 8 |
...
Example
Here are some examples of job requirements that include property expressions:
% qbsub --requirements "host.os eq linux" ls
% qbsub --requirements "host.name eq host01" ls
% qbsub --requirements "host.flag.remove_logs host.group has host05" ls
% qbsub --requirements "(host.os == 'winnt') and host.processor_speed >= 100" ls
Resource operands are slightly different and include those defined by your administrator host.
...
Example
Here is an example of a job requirement that uses a host resource expression:
% qbsub --requirements "host.processors.total > 10" ls
The possible operands for a job.type are:
...
Example
Here are examples of job requirements that use job resource expressions:
% qbsub --requirements "job.type in host.jobtypes" ls% qbsub --requirements "job.user eq host.name" ls
Advanced Requirements Expression Examples
More advanced uses of the requirements expression have allowed many Qube users to route a job to a specific host and also conversely restrict a job from a host.
Common Uses:
Run my job only on linux hosts:
host.os eq linux
Run my job on any host except qb001:
host.name ne "qb001"
Run the job on a host with the Maya job type:
"maya" in host.jobtypes
Run my job only on dual processor hosts:
host.processors.total == 2
Run my job only if there isn't already one of this job's subjobs running on it:
not (job.id in host.duty.id)