Slurm

# Slurm integration for Coldfront Coldfront django plugin providing Slurm integration for Coldfront. Subscriptions in Coldfront are marshalled out to Slurm associations in the Slurm flat file format and can be loaded with sacctmgr. For more information on the Slurm flat file format see [here](https://slurm.schedmd.com/sacctmgr.html).

A command line tool is also provided with this app that allows an administrator to check the consistency between Coldfront and Slurm and optionally remove any associations that should not be in Slurm according to Coldfront.

## Design

Resources in Coldfront map to Clusters (or partitions within a cluster) in Slurm. The name of the Slurm cluster is taken from a resource attribute in Coldfront named “slurm_cluster”. You can optionally provide Slurm specifications for a cluster using a resource attribute named “slurm_specs”. The value of this attribute must conform to the Slurm specification format and are colon separated.

Subscriptions in Coldfront map to Accounts in Slurm. The name of the Slurm account is taken from a subscription attribute in Coldfront named “slurm_account_name” . You can optionally provide Slurm specifications for the account using a subscription attribute named “slurm_specs”. The value of this attribute must conform to the Slurm specification format and are colon separated.

Subscription users in Coldfront map to Users in Slurm. You can optionally provide Slurm specifications for each user in a subscription using a subscription attribute named “slurm_user_specs”. The value of this attribute must conform to the Slurm specification format and are colon separated. Setting specifications on an individual user basis is not currently supported.

## Usage

To enable this plugin add or uncomment the following in your local_settings.py file:

```
EXTRA_APPS += [
‘coldfront.plugins.slurm’,

] SLURM_NOOP = False SLURM_SACCTMGR_PATH = ‘/usr/bin/sacctmgr’

```

To generate Slurm association data from Coldfront run the following command:

```
$ python manage.py sacctmgr_dump -o /output_dir

```

You can then load this file into Slurm with the following command:

```
$ sacctmgr load file=/output_dir/tux.cfg

```

## Special cases

Resources in Coldfront can optionally be organized into parent/child relationships. This is useful in the context of Slurm for example if you have a single Slurm controller with multiple partitions. Each partition represents a separate resource in Coldfront that users can subscribe to. In this case you would create a parent resource that represents your Slurm cluster (or controller) with a resource type of “Cluster”. Each Slurm partition would be a separate resource in Coldfront with a resource type of “Partition” and have their parent resource set to the Slurm cluster. Users wouldn’t subscribe to the parent Slurm cluster resource but only subscribe to the partition resources. Here you would only set the “slurm_cluster” resource attribute on the Slurm cluster resource and not on the partitions. Also, “slurm_specs” resource attribute on partitions are merged with the subscription “slurm_specs” and set on the Slurm account association instead of the cluster.

## CLI Usage

To check the consistency between Coldfront and Slurm run the following command:

```
$ sacctmgr dump file=/output_dir/tux.cfg $ python manage.py slurm_check -i /output_dir/tux.cfg

```

This will process the output of sacctmgr dump flat file and compare to active subscriptions in Coldfront. Any users with Slurm associations that are not members of an active Subscription in Coldfront will be reported and can be removed. You can optionally provide the ‘–sync’ flag and this tool will remove associations in Slurm using sacctmgr.