An interactive job submission tool: ssubmit

Warning

The ssubmit tool is only available on Hercules2 cluster

Overview

For users who are not yet very experienced in using the SLURM batch system, we provide a tool, ssubmit, that simplifies job submission.

Usage

A batch job can be submitted using the ssubmit command

ssubmit program arg1 arg2 ...

where:

  • program is the application you want to run
  • arg1 arg2 ... are the program arguments (if any)

Then, ssubmit will ask you for the resources reserved for your job in terms of time, memory and number of cores.

The following example will submit a job that executes the echo command with 'hello from ...' as argument on a compute node using 1 core with 1 Gb of memory during 1 hour.

ssubmit echo ‘hello from job id $SLURM_JOB_ID running on compute node $(hostname)’

====== Time ====================================================================

  [1]  1 hour (default)
  [2]  1 day
  [3]  5 days
  [4]  15 days (max)

  Your choice or your time (DD-HH:MM or HH:MM): 1

  Using serial paradigm 1 process


====== Memory ==================================================================

  Memory per process in GB (defaul 1GB  max 2000GB): 1

====== Summary =================================================================

  You are about to submit a job to the cluster.
  Please check if everything is correct.

                Job name: echo
              Executable: echo
               Arguments: ‘hello from job id running on compute node hercules’
    Number of processors: 1
    Memory per processor: 1024
                    Time: 00-01:00:00
               Partition: batch

  Would you like to continue [Y/n] ?y

====== Submitted job informations ==============================================

                  Job id: 201403967
              Job output: slurm-201403967.out
     Get job status with: squeue -j 201403967


             JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
         201403967     batch     echo jcabrera PD       0:00      1 (None)

In this case, the job output is located in slurm-201403967.out and the submission script is stored in slurm-201403967.sh

Time, memory, number of core can be specified in the command line

ssubmit --time DD-HH:MM --mem-per-cpu MB --ntasks N --job-name NAME program arg1 arg2 ...

Where:

  • –time: Compute time in format DD-HH:MM
  • –mem-per-cpu: Memory per process in MB
  • –ntasks: Number of process
  • –job-name: Name for the job allocation

The -y option allow you to skip the confirmation step

ssubmit --time 00-01:00 --mem-per-cpu 1024 -y echo 'hello world'

Advanced usage

Paradigm

By default, the job paradigm is set to serial so your job will only use one core.

For preinstalled applications supported paradigm are predefined.

If you want to use ssubmit for applications you have installed in you home directory, you need a config.yaml file that contains the paradigm your application is able to use.

For example, the config.yaml for an application that support all allowed paradigms is

---

# List of paradigm this program supports
paradigms:
  - serial
  - smp
  - mpi

Custom configuration path

ssubmit allows you to use a configuration file located in a particular path by using the -p option.

ssubmit -p PATH program args

Template

If you want a customized submission script for your application, you need to write a jinja2 template named template.js . This file must be located in the same directory than config.yaml.

The default template is

{# minimal template #}
{{ path }}/{{ cmd }} {% for i in argv[2:] %}{{ i }} {% endfor %}

where:

  • path is the directory path where your application is located
  • cmd is the command name
  • argv is an array with the command and the arguments.

Other variables you can access are:

  • paradigm is the selected paradigm.
  • sbatch is a dict with the sbatch variables
  • config is a dict with the data you set in config.yaml file
  • inc is the included variables from the python module (see next section)

Python module

ssubmit allows you to implement your own arguments checks and add new variables to the generated submission script.

Create a inc.py in the directory where config.yaml is located. In this file, you can write the following functions depending of your needs.

function description
def check_args(argv)

Add the checks and modifications you need to your program arguments.

  • input: array with the arguments
  • output: array with the checked and/or modified arguments
def inc(argv):

Include new variables needed on your application.

  • input: array with the arguments
  • output: array inc with new variables
def get_sbatch_options():

Append new sbatch parameters.

  • input: none
  • output: a dict with {‘sbatch_variable’: ‘Value’, ...}