Interactive Jobs

Sometimes if can be inconvenient to write a script, submit it, wait for it to run, check it’s output, modify the script, run it again, etc. In this case, it can be much better to run things interactively.

An Interactive job is bound by the same queue time, resources limits, and other constraints of a batch job. The difference is that an interactive job hold your allocation and awaits interactive input.

Requesting an allocation

Before we can run interactively, we need an active allocation. Request one by running salloc with your desired SLURM Directives:

salloc --account <your_account> ... <other SLURM directives>

Note

Interactive jobs are subject to the same queue times of batch jobs. If the cluster is experiencing high utilization, interactive jobs may take a while to be allocated

Important

issuing salloc alone does NOT place you into an allocation, it only allocated it, you must srun in order to use it.

Using the Allocation

Once you have an active allocation, you need to use it. use srun to use an active allocation

srun some-command

Each srun will be run on your allocation, commands run without srun will not. If you would like a full shell where all commands are run on your allocation, you can issue

srun --pty bash

Press Ctrl+ C or type exit to leave the shell

Each srun does not sit in the queue, it’s immediately run on the active allocation. Users may srun as many times as they like in this environment.

When finished, Press Ctrl+C or type exit to relinquish the allocation.

Note

If you do not already have an allocation, srun will request one. However, unlike with salloc, srun will immediately relinquish the allocation upon completion. srun can also be passed SLURM Directives to specify allocation parameters