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.
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.