Skip to main content

Job Requirements

Jobs can have requirements, which are resources or other conditions which must be available before the job can run. Qube!'s requirement specification is expression based. The syntax for specifying the expression is similar to Perl or C. The proper use of these expressions will allow a user to specify the host and/or the conditions required.

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.

Operators

OperatorDefinitionExpressionResult
minminimum10 min 1210
maxmaximum10 max 1212
sub, -subtract10 sub 82
add, +addition1 + 23
mul, *multiplication3 * 412
div, /division14 / 72
xor, ^XOR12 xor 84
mod, %modulus10 % 42
invalue in list (string with commas)"v" in "x,y,v"true
haslist (string with commas) has value"x,y,v" has "v"true
not, !NOTnot 1false
eq, =, ==equal10 == 10true
ne, <>, !=NOT equal10 != 10false
and, &&AND1 and 0false
or, ||OR1 or 0true
&bitwise AND12 & 88
|bitwise OR8 | 412
lt, <less than5 < 10true
gt, >greater than5 > 10false
le, <=less than or equal4 >= 6false
ge, >=greater than or equal4 <= 6true
rs, >>bitwise right shift (used to divide by 2n)4 >> 12
ls, <<bitwise left shift (used to multiply by 2n)4 << 18

The reason for multiple definitions for most operators is to allow a programmer more flexibility in the case of Unix command line applications where reserved characters such as ">", unless otherwise escaped, will be interpreted by the shell.

Operands

Operands in Qube! also have a syntax. They all follow a base class.type format.

Host.type operands

OperandValues
host.os"linux", "irix", "winnt", "osx"
host.processor_speedCPU speed in MHz
host.processor_make"GenuineIntel", "AuthenticAMD"
host.processor_model"pentium"
host.kernel_versionVersion reported by the operating system.
host.architecture"intel", "mips"
host.nameHost name
host.groupsComma delimited list of group names
host.clusterCluster specification string
host.stateHost state
host.restrictionsList of restricted cluster specification strings
host.flagsNumeric representation of the Worker's flags
host.qube_versionWorker version of Qube!
host.jobtypesComma delimited list of job types
host.flag.nametrue if the flag exists
host.duty.propertyComma delimited list of job properties for jobs on the worker.

Resource operands

are slightly different and include those defined by your administrator host.

Operand (resource)Values
host.processors.[ used | avail | total ]Number of processors available on the worker
host.memory.[ used | avail | total ]Memory in Mb available on the worker
host.swap.[ used | avail | total ]Swap space available in Mb on the worker

Job operands

The possible operands for a job.type are:

OperandDescription
job.namejob name
job.idjob id
job.pidjob's parent id
job.pgrpjob process group
job.priorityjob priority
job.labeljob's label
job.userjob's owner
job.statusjob status
job.prototype,job.typejob type
job.clusterjob's cluster value
job.restrictionsrestrictions list
job.kinduser defined job "kind"
job.reservationsjob's reservations
job.requirementsjob's requirements
job.flagsjob's flags numeric value
job.flag.[name]true if the flag exists
job.kindjob kind

Examples

SyntaxExplanation
% qbsub --requirements "host.processors.total > 10" setCommand line example that uses a host resource expression
host.os eq linuxRun my job only on Linux hosts
"host.os == 'winnt' and host.processor_speed >= 3000"Run on a Windows machine that has a processor speed of at least 3GHz
host.name ne "qb001"Run my job on any host except qb001
"maya" in host.jobtypesRun the job on a host with the Maya job type
host.processors.total == 2Run my job only on dual processor hosts
not (job.id in host.duty.id)Run my job only if there isn't already one of this job's instances running on it
job.kind = 'test' (or any other value, your choice...)
not(job.kind in host.duty.kind)

(Also see How to restrict a host to only one instance of a given kind of job, but still allow other jobs)
Run only one "kind" of job on a worker at the same time \ (this will allow other kinds of jobs still to run, different from reserving all job slots)