SLURM Job Completion Logging Plugin API

Overview

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

SLURM job completion logging plugins are SLURM plugins that implement the SLURM API for logging job information upon their completion. This may be used to log job information to a text file, database, etc. The plugins must conform to the SLURM Plugin API with the following specifications:

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

The sacct program with option -c can be used to display gathered data from database and filetxt plugins.

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

The programmer is urged to study src/plugins/jobcomp/filetxt/jobcomp_filetxt.c and src/plugins/jobcomp/none/jobcomp_none.c for sample implementations of a SLURM job completion logging 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_JOBCOMP_MIN and ESLURM_JOBCOMP_MAX as defined in slurm/slurm_errno.h. The error number should be returned by the function slurm_jobcomp_get_errno() and this error number can be converted to an appropriate string description using the slurm_jobcomp_strerror() function 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. 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_jobcomp_set_location (char * location);

Description: Specify the location to be used for job logging.

Argument: location    (input) specification of where logging should be done. The interpretation of this string is at the discresion of the plugin implementation.

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.

int slurm_jobcomp_log_record (struct job_record *job_ptr);

Description: Note termin ation of a job with the specified characteristics.

Argument:
job_ptr   (input) Pointer to job record as defined in src/slurmctld/slurmctld.h

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.

int slurm_jobcomp_get_errno (void);

Description: Return the number of a job completion logger specific error.

Arguments: None

Returns: Error number for the last failure encountered by the job completion logging plugin.

const char *slurm_jobcomp_strerror(int errnum);

Description: Return a string description of a job completion logger specific error code.

Arguments: errnum    (input) a job completion logger specific error code.

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

void slurm_jobcomp_get_jobs(List job_list, List selected_steps, List selected_parts, void *paramsint errnum);

Description: Get completed job info from the storage.

Arguments:
job_list (input/output) List of job_rec_t pointers of requested jobs.
selected_steps (input) list containing type jobacct_select_step_t to query against.
selected_parts (input) list containing char *'s of names of partitions to query against.
params (input) to be cast as sacct_parameters_t in the plugin.

jobcomp_job_rec_t is defined in common/slurm_jobcomp.h

Returns: None

void slurm_jobcomp_archive(List selected_parts, void *params)

Description: used to archive old data.

Arguments:
List selected_parts (input) list containing char *'s of names of partitions to query against.
void *params (input) to be cast as sacct_parameters_t in the plugin.

Returns: None

Versioning

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

Last modified 10 September 2007

Lawrence Livermore National Laboratory
7000 East Avenue • Livermore, CA 94550
Operated by Lawrence Livermore National Security, LLC, for the Department of Energy's
National Nuclear Security Administration
NNSA logo links to the NNSA Web site Department of Energy logo links to the DOE Web site