# SLURM Job Accounting Plugin API

## Overview

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

SLURM job accounting plugins must conform to the SLURM Plugin API with the following specifications:

const char plugin_name[]="full text name"

A free-formatted ASCII text string that identifies the plugin.

const char plugin_type[]="major/minor"

The major type must be "jobacct." The minor type can be any suitable name for the type of accounting package. We currently use

- linux—Gathers information from linux proctable and addes this information to the standard rusage information already gathered for each job.
- none—No extra information gathered.

The sacct program can be used to display gathered data from regular accounting and from these plugins.

The programmer is urged to study src/plugins/jobacct/linux for a sample implementation of a SLURM job accounting plugin.

## API Functions

The job accounting API uses hooks in the slurmstepd.

All of the following functions are required. Functions which are not implemented must be stubbed.

#### Functions called by all slurmstepd processes

int jobacct_p_init(int frequency)

Description: jobacct_p_init() is called at the beginning of each process at the start of the slurmstepd, this starts a thread that should poll information to be gathered at the end of the process. Put global initialization here.

Arguments: frequency (input) poll frequency for gathering thread.

Returns: SLURM_SUCCESS on success, or SLURM_FAILURE on failure.

int jobacct_p_fini(slurmd_job_t *job)

Description: jobacct_p_fini() is called when the process is finished gathered information is placed in the slurmd_job_t structure. This function will also stop the gathering thread.

Arguments: job (input) structure to hold information gathered from gathering thread.

Returns: SLURM_SUCCESS on success, or SLURM_FAILURE on failure.

int jobacct_p_suspend()

Description: jobacct_p_suspend() is called when the process is suspended by the slurmctld. This causes the polling thread to halt until the process is resumed.

Arguments: none

Returns: SLURM_SUCCESS on success, or SLURM_FAILURE on failure.

## Parameters

Rather than proliferate slurm.conf parameters for new or evolved plugins, the job accounting API counts on three parameters:

JobAcctType
  Specifies which plugin should be used.
JobAcctFrequency
  Let the plugin know how long between pollings.

## Versioning

This document describes version 1 of the SLURM Job Accounting API. Future releases of SLURM may revise this API. A job accounting plugin conveys its ability to implement a particular API version using the mechanism outlined for SLURM plugins.

Last modified 6 April 2006