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 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 preemptable 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
When… |
The behavior is … |
---|---|
Preemption is not enabled—no queue is defined as preemptable, and no queue is defined as preemptive |
|
A queue is defined as preemptable, but no specific queues are listed that can preempt it |
|
A queue is defined as preemptable, and one or more queues are specified that can preempt it |
|
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 |
|
The queues can preempt as follows:
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
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.
When… |
The effect on the calculation of job slots used is … |
---|---|
Preemption is not enabled |
|
Preemption is enabled |
|
Preemption is enabled, and PREEMPT_FOR=GROUP_JLP |
|
Preemption is enabled, and PREEMPT_FOR=GROUP_MAX |
|
Preemption is enabled, and PREEMPT_FOR=HOST_JLU |
|
Preemption is enabled, and PREEMPT_FOR=USER_JLP |
|
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. For example,
If … |
Is configured … |
And a priority of … |
The behavior is … |
---|---|---|---|
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.