slurm.el
is an Emacs extension allowing to work more easily with the
SLURM job scheduling system.
It is composed of two parts:
slurm-script-mode
: a minor mode to edit job submission scripts;slurm-mode
: a major mode allowing interaction with SLURM.
Ensure the following dependencies are installed:
M-x package-install RET slurm-mode RET
to install slurm.el
from MELPA.
Just put the following lines in your Emacs initialization file (.emacs
or .emacs.d/init.el
):
(add-to-list 'load-path "/path/to/slurm.el")
(require 'slurm-mode)
(require 'slurm-script-mode)
slurm-script-mode
is automatically activated for shell-scripts containing #SBATCH
directives. It
can also be manually toggled by running M-x slurm-script-mode
.
While in this mode, #SBATCH
directives are highlighted and some basic errors are detected (unknown
or misspelled keywords, unproperly quoted arguments, ...)
New directives can also be easily inserted using the C-c C-d
binding, which proposes completion
on the keywords.
Just run M-x slurm
on any remote buffer to see a list of all SLURM jobs on the cluster. It can handle multiple SLURM servers by creating a separate buffer for each server.
slurm.el
defines several views to present SLURM information. Each view first presents the command
line which has been used to obtain the information presented.
In all views, the following bindings are available:
h
: show Helpg
: refresh view
The following key bindings can be used to switch between views:
j
: Jobs list (default view)p
: Partitions listi
: Cluster Informationa
: Accounting information for all jobs
This view displays the list of all jobs managed by SLURM on the cluster, as obtained with the
squeue
command.
The jobs list can be manipulated using the following bindings:
-
/
: filter the jobs list by:u
: User;p
: Partition.
-
s
: sort the jobs list by:u
: User;p
: Partition;P
: job Priority;d
: use the Default sorting order;c
: Customize sorting order by specifying a suitable argument for the-S
switch ofsqueue
.
Giving this command a prefix argument reverses the sorting order. For example,
C-u s u
sorts by user in reverse alphabetical order.
A few operations can be done from this view:
-
RET
: show job details, as obtained with thescontrol show job JOBID
command. -
U
: show User details on the job submitter (using thefinger USER
command). -
k
ord
: Kill job by issuing thescancel JOBID
command. -
S
: Prints a summary of requested and used resources of the job -
e
oru
: Edit (or Update) job.In this mode, job submission parameters can be interactively updated (as could be done using the
scontrol update job JOBID
command). Each parameter is presented on its own line. After editing a line, pressingC-c C-c
validates the changes (on the current line only), orC-c C-q
cancels the changes and returns to the previous view.
This view displays a list of all partitions on the cluster, as obtained with the scontrol show partition
command.
While in this view, pressing RET
allows you to access various details about the selected partition
state, as obtained using the sinfo
command.
This view displays details on the current cluster state, as obtained with the sinfo
command.
This view displays accounting information of all the jobs submitted from a given date, as obtained with the sacct
command.
In this view, pressing S
shows the summary of reuested and used resources of the past jobs. A feature to keep track of resources utilized by the elapsed jobs.
Some variables can be set to customize slurm-mode
's behaviour:
-
slurm-display-help
: if non-nil,slurm-mode
displays an help message at the top of the screen; -
slurm-filter-user-at-start
: if non-nil, the initial jobs list is filtered to show only jobs owned by the current user. -
slurm-script-directive-face
: face name to use for#SBATCH
directives in job submission scripts. -
slurm-squeue-format
: the list of fields to display in the jobs list. -
slurm-sacct-format
: the list of fields to display in the accounting information.
All these variables can be customized via M-x customize-group RET slurm RET
.
Check the slurm-demo.gif
in the demo
directory.
If you make improvements to this code or have suggestions, please do not hesitate to fork the repository or submit bug reports on github. The repository's URL is:
https://github.com/ffevotte/slurm.el.git
Copyright (C) 2012-2021 François Févotte, Soumya Tripathy
slurm-script-mode.el
originally comes from the
slurm-helper and is (C)
Damien François.
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.