Sort Jobs

Sort jobs on a key that you specify.

Job Sorting

Overview of jobs sorting including parameters and examples.

PBS allows you to sort jobs on a key that you specify. This can be used when setting both execution and preemption priority. Sorting jobs comes into play after jobs have been divided into classes, because each class may contain more than one job. You can sort on one or more of several different keys, and for each key, you can sort either from low to high or from high to low.

You configure sorting jobs on a key by setting values for the Job Sort Keys parameter. When preemption is enabled, jobs are automatically sorted by preemption priority.

You can create an invisible, unrequestable custom resource, and use a hook to set the value of this resource for each job. The hook modifies the job’s resource request to include the new resource, and sets the value to whatever the hook computes. Then you can sort jobs according to the value of this resource.

The Job Sort Keys parameter is a primetime option, meaning that you can configure it separately for primetime and non-primetime, or you can specify it for all of the time.

Job Sort Keys can be used to sort using either (a) resources or (b) special case sorting routines. Multiple Job Sort Keys entries can be used, one to a line, in which case the first entry will be the primary sort key, the second will be used to sort equivalent items from the first sort, etc.

You can use the following keys for sorting jobs:
Sort Key Description
PBS resource name Sorts jobs according to how much of the specified resource they request.
fairshare_perc

Sorts according to fairshare percentage allotted to entity that owns job. This percentage is defined in the resource_group file.

If user A has more priority than user B, all of user A's jobs are always run first. Past history is not used.

job_priority Sorts jobs by the value of each job’s priority attribute.

Parameters

Job Sort Keys

Specifies how jobs should be sorted. It is overridden by the Job Sort Formula parameter. If both are set, Job Sort Keys is ignored and an error message is printed.

Sort Priority
Determine whether the jobs are sorted from high to low (HIGH) or low to high (LOW).
Modifiers
Determines whether the sorting is implemented for prime time, non-prime time or both.

Example 1

The following example illustrates how to sort jobs so that those with high CPU count come first:

Job Sort Keys: “ncpus HIGH” all

Example 2

The following example shows how to sort jobs so that those with lower memory come first:

Job Sort Keys: “mem LOW” prime

Example 3

Sort jobs so that those with long walltime come first:

Job Sort Keys: “walltime HIGH”

Example 4

You want big jobs to run first, where “big” means more CPUs, and if the CPUs are the same, more memory, sort on the number of CPUs requested, then the amount of memory requested:

Job Sort Keys: “ncpus HIGH” all

Job Sort Keys: “mem HIGH” all

Example 5

Sort jobs so that those with lower memory come first:

Job Sort Keys: “mem LOW” prime

Example 6

Sort jobs according to the value of an invisible custom resource called JobOrder:

Job Sort Keys: “JobOrder LOW” all

Sort Jobs on a Key

Sort jobs based on a specified key.

Important: The Job Sort Keys parameter can only be updated if the cluster was added by a user with passwordless sudo permissions and therefore may not appear as a Scheduling parameter.
  1. Click the Configure tab.
  2. Choose the HPC to configure.

    Choose an HPC
    Figure 1. Choose an HPC
  3. Click Scheduling from the PBS Professional menu located on the left-hand side of the web page.
  4. Scroll down to the Job Sort Keys parameter.
  5. Choose on of the following options:
    • Click when there are existing job sort keys.
    • Click when there are no existing job sort keys.
  6. For Job Sort Keys, choose one of the following options:.
    • Enter fairshare_perc to sort jobs according to the fairshare percentage allotted to the entity that owns the job.
    • Enter job_priority to sort jobs by the value of each job’s priority attribute.
    • Enter a resource name to sort jobs according to how much of the specified resource they request.
  7. For Sort Priority, choose one of the following options:
    • HIGH - sort from high to low.
    • LOW - sort from low to high.
  8. Determine whether job sorting is implemented for prime time, non-prime time or both:
    • To configure the sort key for both prime and non-prime time, enable both Prime and Non-Prime.
    • To configure the sort key for only prime time, enable Prime and disable Non-Prime.
    • To configure the sort key for only non-prime time, enable Non-Prime and disable Prime.
  9. To add another sort key:
    1. click .
    2. Repeat steps 6 through 8.
    Tip: To delete a job sort key click .
  10. Click to save the change.