Running an Interactive Job

From CAC Documentation wiki
Jump to navigation Jump to search

You can turn any job into an interactive job by adding a PBS directive "-I", as in Interactive. You may run an interactive job on any queue. If the batch file includes more commands, the scheduler will ignore them. It reads directives, then gives you the node without running the batch script.

For instance, the following script is exactly the same one that ran as a regular batch job, but the "#PBS -I" line is added:

#PBS -l walltime=00:30:00,nodes=1
#PBS -A your_account
#PBS -j oe
#PBS -N batchtest
#PBS -q v4dev

# Turn on echo of shell commands
set -x

# Did you not put these in your ~/.profile? Then include them here.
#export PATH=$PATH:/opt/nextgen/bin
#export PERL5LIB=/opt/nextgen/lib/perl5

# The data is located in datadir.

echo starting job `date`
# Copy data to a temporary directory.
# Move to that directory.
cd ${TMPDIR}
fastx_quality_stats -i ${DATA} -o stat.xls
# Copy the data back.
cp stat.xls ${PBS_O_WORKDIR}/
echo finishing job `date`

For interactive jobs, the scheduler will wait until the node is available and open an ssh shell as soon as a node is ready, which may take some time. Use 'showqlease' to check on free nodes by the queue:

$ showqlease
[user@linuxlogin]$ nsub
Looking for directives in
Executing interactive
qsub: waiting for job 1001525.scheduler.v4linux to start
qsub: job 1001525.scheduler.v4linux ready
[user@compute-3-48 farm]$

That last prompt shows that you are now typing in a shell on the main node of your interactive job. Commands, such as mpiexec, should work here just as they would in a batch script. From here, you could run the rest of your script.

[user@compute-3-48 farm]$ cd ~/nextgen
[user@compute-3-48 farm]$ source

The source command runs the script in the current shell. Another way to run the script is to tell the operating system that the file is executable. Then the script can be run like any other executable.

$ chmod a+x
$ ./