# SLURM Job Accounting Gather Plugin API

## Overview

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

SLURM job accounting gather 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_gather." The minor type can be any suitable name for the type of accounting package. We currently use

- aix— Gathers information from AIX /proc table and adds this information to the standard rusage information also gathered for each job.
- cgroup—Gathers information from Linux cgroup infrastructure and adds this information to the standard rusage information also gathered for each job. (Experimental, not to be used in production.)
- linux—Gathers information from Linux /proc table and adds this information to the standard rusage information also gathered for each job.
- none—No 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_gather/linux and src/common/slurm_jobacct_gather.[c|h] for a sample implementation of a SLURM job accounting gather plugin.

## API Functions

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

int jobacct_gather_p_poll_data(List task_list, bool pgid_plugin, uint64_t cont_id)

Description:
jobacct_gather_p_poll_data() Build a table of all current processes.

Arguments:
task_list (in/out) List containing current processes
pgid_plugin (input) if we are running with the pgid plugin cont_id (input) container id of processes if not running with pgid

int jobacct_gather_p_endpoll()

Description:
jobacct_gather_p_endpoll() is called when the process is finished to stop the polling thread.

Arguments:
none

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

int jobacct_gather_p_add_task(pid_t pid, uint16_t tid)

Description:
jobacct_gather_p_add_task() used to add a task to the poller.

Arguments:
pid (input) Process id
tid (input) slurm global task id

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

## Parameters

These parameters can be used in the slurm.conf to set up type of plugin and the frequency at which to gather information about running jobs.

JobAcctGatherType
  Specifies which plugin should be used.
JobAcctGatherFrequency
  Let the plugin know how long between pollings.

## Versioning

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

Last modified 29 May 2012