Simple Linux Utility for Resource Management

Home

About
Overview
What's New
Publications
SLURM Team

Using
Documentation
FAQ
Getting Help
Mailing Lists

Installing
Platforms
Download
Guide

SLURM Scheduler Plugin API

Overview

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

It is noteworthy that two different models are used for job scheduling. The backfill scheduler lets SLURM establish the initial job priority and can periodically alter job priorities to change their order within the queue. The wiki scheduler establishes an initial priority of zero (held) for all jobs. These jobs only begin execution when the wiki scheduler explicitly raises the their priority (releasing them). Developers may use the model that best fits their needs. Note that a separate node selection plugin is available for controlling that aspect of scheduling.

SLURM scheduler plugins are SLURM plugins that implement the SLURM scheduler API described herein. They must conform to the SLURM Plugin API with the following specifications:

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

  • builtin—A plugin that implements the API without providing any actual scheduling services. This is the default behavior and implements first-in-first-out scheduling.
  • backfill—Raise the priority of jobs if doing so results in their starting earlier without any delay in the expected initiation time of any higher priority job.
  • wiki—Use The Maui Scheduler (Wiiki version) as an external entity to control SLURM job scheduling.

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

The programmer is urged to study src/plugins/sched/backfill and src/plugins/sched/builtin for sample implementations of a SLURM scheduler plugin.

Data Objects

The implementation must maintain (though not necessarily directly export) an enumerated errno to allow SLURM to discover as practically as possible the reason for any failed API call. Plugin-specific enumerated integer values should be used when appropriate. It is desirable that these values be mapped into the range ESLURM_SCHED_MIN and ESLURM_SCHED_MAX as defined in slurm/slurm_errno.h. The error number should be returned by the function slurm_sched_get_errno() and string describing the error's meaning should be returned by the function slurm_sched_strerror() described below.

These values must not be used as return values in integer-valued functions in the API. The proper error return value from integer-valued functions is SLURM_ERROR. The implementation should endeavor to provide useful and pertinent information by whatever means is practical. In some cases this means an errno for each credential, since plugins must be re-entrant. If a plugin maintains a global errno in place of or in addition to a per-credential errno, it is not required to enforce mutual exclusion on it. Successful API calls are not required to reset any errno to a known value. However, the initial value of any errno, prior to any error condition arising, should be SLURM_SUCCESS.

API Functions

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

int slurm_sched_plugin_schedule (void);

Description: For passive schedulers, invoke a scheduling pass.

Arguments: None

Returns: SLURM_SUCCESS if successful. On failure, the plugin should return SLURM_ERROR and set the errno to an appropriate value to indicate the reason for failure.

uint32_t slurm_sched_plugin_initial_priority (uint32_t max_prio);

Description: Establish the initial priority of a new job.

Arguments: max_prio    (input) maximum priority of any previously submitted job. This can be used to provide First-In-First-Out scheduling by assigning the new job a priority lower than this value. This could also be used to establish an initial priority of zero for all jobs, representing a "held" state. The scheduler plugin can then decide where and when to initiate pending jobs by altering their priority and (optionally) list of required nodes.

Returns: The priority to be assigned to this job.

void slurm_sched_plugin_job_is_pending (void);

Description: Note that some job is pending execution..

Arguments: None

Returns: Nothing.

int slurm_sched_get_errno (void);

Description: Return the number of a scheduler specific error.

Arguments: None

Returns: Error number for the last failure encountered by the scheduler plugin.

const char *slurm_sched_strerror(int errnum);

Description: Return a string description of a scheduler specific error code.

Arguments: errnum    (input) a scheduler specific error code.

Returns: Pointer to string describing the error or NULL if no description found in this plugin.

Versioning

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


For information about this page, contact slurm-dev@lists.llnl.gov.