# SLURM Preemption Plugin API

## Overview

This document describes SLURM preemption plugins and the API that defines them. It is intended as a resource to programmers wishing to write their own SLURM preemption plugins. This is version 100 of the API.

SLURM preemption plugins are SLURM plugins that identify which jobs can be preempted by a pending job. They must conform to the SLURM Plugin API with the following specifications:

const char plugin_type[]="major/minor"
The major type must be "preempt." The minor type can be any recognizable abbreviation for the type of preemption. We recommend, for example:

- none—This plugin prevents any job preemption.
- partition_prio—This plugin permit pending jobs from one partition to preempt jobs from a lower priority partition.
- qos—This plugin permits jobs to preempt others based upon their Quality Of Service values as defined in the SLURM database.

The plugin_name and plugin_version symbols required by the SLURM Plugin API require no specialization for job preemption support. Note carefully, however, the versioning discussion below.

The programmer is urged to study src/plugins/preempt/partition_prio/preempt_partition_prio.c for an example implementation of a SLURM preemption plugin.

## API Functions

The following functions must appear. Functions which are not implemented should be stubbed.

struct job_record **find_preemptable_jobs( struct job_record *job_ptr)

Description: Identifies the jobs which can be preempted by a specific pending job.

Arguments:
job_ptr (input) a pointer to the pending job which is attempting to be started

Returns: An array of pointers to jobs which may be preempted. The array should be NULL terminated and will be released using the xfree function when no longer required. This array should be sorted in order from most attractive to preempt to least attractive to preempt (e.g. lowest to highest priority). For example, even within a given partition or QOS one might want to smaller jobs first.

## Versioning

This document describes version 100 of the SLURM Preemption API. Future releases of SLURM may revise this API. A preemption plugin conveys its ability to implement a particular API version using the mechanism outlined for SLURM plugins.

Last modified 24 August 2009