Wednesday, August 08, 2012

a small trick to record the job log file

We usually write out the job log to sge_job.$JOBID.out in sge script:

#$ -V
#$ -pe single 8
#$ -cwd
#$ -o $HOME/sge_jobs_output/sge_job.$JOB_ID.out -j y
#$ -S /bin/bash
#$ -l mem_free=2G

When submit the job using qsub, it will report the jobid. But you have to record the id in order to track back the log file. Here is a little trick to help you always keep tracking the log file:

jobid=`qsub $dir/$samplename/$samplename.sge | cut -f3 -d' '`
ln -fs $HOME/sge_jobs_output/sge_job.$jobid.out $dir/$samplename/sge.log

echo "Your job is submitted with jobID: $jobid
The SGE script is saved as $dir/$samplename/$samplename.sge
The running log is saved as $dir/$samplename/sge.log"

No comments:

Post a Comment