Running an Interactive Job

From CAC Documentation wiki
Revision as of 14:22, 29 September 2015 by Ad876 (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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:

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

# 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.
DATADIR=/home/gfs08/jp86/ngw2010/session1/lecture2/
DATA=s_8_1_sequence.txt

echo starting job `date`
# Copy data to a temporary directory.
cp ${DATADIR}/${DATA} ${TMPDIR}
# 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 batch.sh
Looking for directives in batch.sh
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 batch.sh

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 batch.sh
$ ./batch.sh