# Slurm Route Plugin Programmer Guide

## Overview

This document describes Slurm Route plugin and the API that defines them. It is intended as a resource to programmers wishing to write their own Slurm Route plugin.

Slurm Route plugins are Slurm plugins that redirect RPCs through intermediate forwarding nodes. The routing mechanism is similar to message forwarding which was designed to move message processing overhead off the controller. The main difference is that the routine table is defined in the configuration. For example, the topology implementation uses the topology.conf file.

The plugins must conform to the Slurm Plugin API with the following specifications:

const char plugin_type[]
The major type must be "rout" The minor type specifies the type of route mechanism.

- default — No routing information.
- topology — Route messages using topology.conf information.

const char plugin_name[]
Some descriptive name for the plugin. There is no requirement with respect to its format.

uint32_t plugin_version
If specified, identifies the version of Slurm used to build this plugin and any attempt to load the plugin from a different version of Slurm will result in an error. If not specified, then the plugin may be loaded by Slurm commands and daemons from any version, however this may result in difficult to diagnose failures due to changes in the arguments to plugin functions or changes in other Slurm functions used by the 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 may be used when appropriate.

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 init (void)

Description:
Called when the plugin is loaded, before any other functions are called. Put global initialization here.

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

void fini (void)

Description:
Called when the plugin is removed. Clear any allocated storage here.

Returns: None.

Note: These init and fini functions are not the same as those described in the dlopen (3) system library. The C run-time system co-opts those symbols for its own initialization. The system _init() is called before the Slurm init(), and the Slurm fini() is called before the system's _fini().

extern int route_g_split_hostlist(hostlist_t hl, hostlist_t** sp_hl, int* count);

Description:
Split an input hostlist into a set of hostlists to forward to.

Arguments:
hl (in) hostlist to split sp_hl (out) the array of hostlist that will be malloced count (out) the count of created hostlist

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

extern int route_g_reconfigure ( void );

Description:
Reset internal state during reconfigure.

Returns:
SLURM_SUCCESS on success, or
SLURM_ERROR on failure.

extern slurm_addr_t* route_g_next_collector ( bool *is_collector );

Description:
get address of parent in message tree.

Arguments:
is_collector (out) flag indication this node is a collector.

Returns:
slurm_addr_t* address of node to send messages to be aggregated
NULL if not set.

extern slurm_addr_t* route_g_next_collector_backup ( void );

Description:
get address of parent's backup in message tree.

Returns:
slurm_addr_t* address of node to send messages to be aggregated when primary collector is down.
NULL if not set.

Last modified 27 March 2015