Skip to content

Interactive jobs

Interactive jobs allow users to interact with applications in real-time within cluster. With these jobs, users can request resources in the cluster, and then use them to run commands or scripts directly via the command line instead of running a set of commands provided by a sbatch file.

This allows for a regular session on inside a job, which is mainly useful for testing or running quick small computations. The benefit of interactive jobs is that you can run commands live, without having to write every command down in the job file.

The downside is that if something happens to either your internet connection or the head node, then the job dies as well. On top of that, there is no automatic job retry, as the job doesn't know which commands to run again.

Requesting resources

You can request interactive sessions either via salloc or srun using the pseudo-terminal option --pty and specifying the requested shell. You can apply regular Slurm resource options as well. Do keep in mind, that if the requested partition is busy and has no immediate free space for a job, you might have to wait for your interactive session to start.

srun --partition=testing --time=60 --cpus-per-task=4 --pty /bin/bash

Output when using srun:

[user@login1 ~]$ srun --pty /bin/bash
srun: job 16841897 queued and waiting for resources
srun: job 16841897 has been allocated resources

[user@stage53 ~]$