Job Constraints and Preferences

In this section we will learn how to leverage the flexibility of the ClassAd mechanism to attach sophisticated requirements and preferences to jobs so that they find the "best possible machine" to run on.

In this workbook section, we will express constraints that users generally desire to give a flavor of Condor's mechanisms. However, keep in mind that Condor's flexibility lies in the fact that ClassAds can contain arbitrary expressions: feel free to be creative and try out expressions of your own!


Example 1: Explicitly choosing machines to run on

Preliminary: Please change to the example1 directory by typing:
%  cd ~/workbook/submit-rank/example1

We will now place some constraints on where the job will run. Users sometimes want their jobs to only run on specific machines that they choose. Assume that you want your job to run only on your neighbors' machines.

Load the submit command file example1.cmd into your favorite editor. You will see the following Requirements expression:

requirements = Name=="machineLLL.ncsa.uiuc.edu" || Name=="machineRRR.ncsa.uiuc.edu"
Edit the requirements line and change machineLLL and machineRRR to the machine names of your left and right neighbors.

Now submit example1 by typing:

%  condor_submit example1.cmd

You can view the ClassAd of the submitted job by typing

%  condor_q -long
Find out where your job is running by typing
%  condor_status -run
and viewing the entry where your username is listed as the RemoteUser of a machine.

Example 2: Weighted unbounded preferences

Preliminary: Please change to the example2 directory by typing:
%  cd ~/workbook/submit-rank/example2

The flexibility of the Rank mechanism allows submitters to specify arbitrary metrics over machines. For example, they can place weights on machine attributes as in example2:
Requirements = (Arch == "INTEL") && (OpSys == "LINUX")
Rank = ( Memory>=32 ) * ( 10*Mips + 2*KFlops + 100*Memory + 8*VirtualMemory )
The Rank expression states that all machines will less than 32 Mb of memory are weighted equally (at zero), and machines with 32 Mb or more memory are weighted according to their Mips, KFlops, Memory and VirtualMemory.

Submit this example by typing:

%  condor_submit example2.cmd
and find the machine which is running your job with condor_status

Optional


Example 3: Qualitatively choosing machines

Preliminary: Please change to the example3 directory by typing:
%  cd ~/workbook/submit-rank/example3

In this exercise, we will choose machines to run on not by their names, but by their attributes.

View the contents of the example3a submit command file. The requirements expression asks for any machine with more than 32Mb of physical memory and more than 100 Mb of virtual memory. Submit this example by typing:

%  condor_submit example3a.cmd
and find the machine your job runs on by typing:
%  condor_status -run
If you find that your job is running on machineXXX, type
%  condor_status -long machineXXX
and view the ClassAd of machineXXX to verify that it does indeed satisfy the job's constraints.

Similarly, example3b (in the same directory), asks for machines which have a certain MIPS (Million Instructions Per Second) and KFLOPS (Kilo Floating point Operations Per Second) rating. Feel free to edit the command file and edit the expression to include other criteria, and submit it by typing:

%  condor_submit example3b.cmd
If you'd like to, use condor_status to find the machine your job is running on, and view the ClassAd of the machine.

Example 4: Expressing preferences

Preliminary: Please change to the example4 directory by typing:
%  cd ~/workbook/submit-rank/example4

By default, all resources that matches the job's Requirement expression are equally weighted in the matching process. However, jobs may also express preferences specifying a "goodness metric".

When you view the submit command file example4.cmd, you will see:

rank = Memory > 32
This expression evaluates to 1 (i.e., TRUE) when the machine has more than 32 Mb of memory, and 0 (i.e., FALSE) otherwise.

Now submit example4 by typing:

%  condor_submit example4.cmd
Condor will now find an available machine with the highest Rank value for the job (which in this case, is 1).

Example 5: Unbounded preferences

Preliminary: Please change to the example5 directory by typing:
%  cd ~/workbook/submit-rank/example5

Although expressing preferences with boolean valued expressions is useful, it is not expressive enough to state a preference like: "I prefer faster machines". However, the Rank expression of example5 states this very preference using an "unbounded" Rank expression.

View the Rank expression in the submit command file example5.cmd. The expression reads:

rank = Mips
Thus, the higher the MIPS rating of the target machine, the better the rank.

Now submit example5 by typing:

%  condor_submit example5.cmd
and find the machine which is running your job with condor_status