Preemptive scheduling behavior
Preemptive scheduling is based primarily on parameters specified at the queue level: some queues are eligible for preemption, others are not. Once a hierarchy of queues has been established, other factors, such as queue priority and preferred preemption order, determine which jobs from a queue should be preempted.
There are three ways to establish which queues should be preempted:
- Based on queue priority: the PREEMPTION parameter defines a queue as preemptive or pre-emptable and preemption is based on queue priority, where jobs from higher-priority queues can preempt jobs from lower-priority queues
- Based on a preferred order: the PREEMPTION parameter defines queues that can preempt other queues, in a preferred order
- Explicitly, by specific queues: the PREEMPTION parameter defines queues that can be preempted, and by which queues
Preemption configuration | Behavior |
---|---|
Preemption is not enabled—no queue is defined as preemptable, and no queue is defined as preemptive | High-priority jobs do not preempt jobs that are already running |
A queue is defined as preemptable, but no specific queues are listed that can preempt it | Jobs from this queue can be preempted by jobs from any queue with a higher value for priority |
A queue is defined as preemptable, and one or more queues are specified that can preempt it | Jobs from this queue can be preempted only by jobs from the specified queues |
A queue is defined as preemptive, but no specific queues are listed that it can preempt |
|
A queue is defined as preemptive, and one or more specific queues are listed that it can preempt, but no queue preference is specified |
|
A queue is defined as preemptive, and one or more queues have a preference number specified, indicating a preferred order of preemption |
|
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs with the shortest run time is configured |
|
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs that will finish within a certain time period is prevented |
|
A queue is defined as preemptive, or a queue is defined as preemptable, and preemption of jobs with the specified run time is prevented |
|
Case study: Three queues with varying priority
- Queue A has the highest relative priority, with a value of 99
- Queue B is both preemptive and preemptable, and has a relative priority of 10
- Queue C has the lowest relative priority, with the default value of 1
- A can preempt B because B is preemptable and B has a lower priority than A
- B can preempt C because B is preemptive and C has a lower priority than B
- A cannot preempt C, even though A has a higher priority than C, because A is not preemptive, nor is C preemptable
Calculation of job slots in use
The number of job slots in use determines whether preemptive jobs can start. The method in which the number of job slots in use is calculated can be configured to ensure that a preemptive job can start. When a job is preempted, it is suspended. If the suspended job still counts towards the total number of jobs allowed in the system, based on the limits imposed in the lsb.resources file, suspending the job may not be enough to allow the preemptive job to run.
The PREEMPT_FOR parameter is used to change the calculation of job slot usage, ignoring suspended jobs in the calculation. This ensures that if a limit is met, the preempting job can actually run.
Preemption configuration | Effect on the calculation of job slots used |
---|---|
Preemption is not enabled |
|
Preemption is enabled |
|
Preemption is enabled, and PREEMPT_FOR=GROUP_JLP | Only running jobs are counted when calculating the per-processor job slots in use for a user group, and comparing the result with the limit specified at the user level. |
Preemption is enabled, and PREEMPT_FOR=GROUP_MAX | Only running jobs are counted when calculating the job slots in use for this user group, and comparing the result with the limit specified at the user level. |
Preemption is enabled, and PREEMPT_FOR=HOST_JLU | Only running jobs are counted when calculating the total job slots in use for a user group, and comparing the result with the limit specified at the host level. Suspended jobs do not count against the limit for individual users. |
Preemption is enabled, and PREEMPT_FOR=USER_JLP | Only running jobs are counted when calculating the per-processor job slots in use for an individual user, and comparing the result with the limit specified at the user level. |
Preemption of backfill jobs
When a high priority queue is configured to run a job with resource or slot reservations and backfill scheduling is enabled (PREEMPT_JOBTYPE=BACKFILL in lsb.params), backfill jobs may use the reserved job slots. Configuring a low priority queue with a job to preempt a backfill job may delay the start of a job in a high priority queue with resource or slot reservations. LSF allows this configuration but gives a warning message.
Queue name | Configuration | Priority | Result |
---|---|---|---|
queueR | With a resource or slot reservation | 80 | Jobs in these queue reserve resources. If backfill scheduling is enabled, backfill jobs with a defined run limit can use the resources. |
queueB | As a preemptable backfill queue | 50 | Jobs in queueB with a defined run limit use job slots reserved by jobs in queueR. |
queueP | As a preemptive queue | 75 | Jobs in this queue do not necessarily have a run limit and may take resources from jobs with reservation. |
To guarantee a minimum run time for interruptible backfill jobs, LSF suspends them upon preemption. To change this behavior so that LSF terminates interruptible backfill jobs upon preemption, you must define the parameter TERMINATE_WHEN=PREEMPT in lsb.queues.