# Running an interactive job

You can start a new interactive job on your research environment by using the srun command; the scheduler will search for an available compute node, and provide you with an interactive login shell on the node if one is available.

[flight@chead1 (mycluster1) ~]$ srun --pty /bin/bash
[flight@node01 (mycluster1) ~]$
[flight@node01 (mycluster1) ~]$ squeue
           JOBID PARTITION     NAME     USER ST       TIME  NODES NODELIST(REASON)
               3       all     bash    centos R       0:39      1 node01

In the above example, the srun command is used together with two options: --pty and /bin/bash. The --pty option executes the task in pseudo terminal mode, allowing the session to act like a standard terminal session. The /bin/bash option is the command that you wish to run - here the default Linux shell, BASH.

Alternatively, the srun command can also be executed from an interactive desktop session; the job-scheduler will automatically find an available compute node to launch the job on. Applications launched from within the srun session are executed on the assigned research environment compute node.

When you’ve finished running your application in your interactive session, simply type logout, exit, or press Ctrl+D to exit the interactive job.

If the job-scheduler could not satisfy the resource you’ve requested for your interactive job (e.g. all your available compute nodes are busy running other jobs), it will report back after a few seconds with an error:

[flight@chead1 (mycluster1) ~]$ srun --pty /bin/bash
srun: job 20 queued and waiting for resources