1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179
|
##################################################################################################################################
########################## ########################################
########################## Trinity PBS job submission with multi part dependencies ########################################
########################## ########################################
##################################################################################################################################
### Author: Josh Bowden, Alexie Papanicolaou, CSIRO
### Version 1.0
### Function definitions and PBS version specific information
##################################################################################################################################
######################################################################################################################
### Return usage information if user requests --help -h or another incorrect input flag.
######################################################################################################################
function F_USAGE {
echo ""
echo " Usage: "
echo ""
echo " To start an analysis: "
echo " trinity_pbs.sh <config.file> "
echo ""
echo " To stop previously started PBS jobs in the queue: "
echo " trinity_kill.pl OUTPUTDIR "
echo ""
echo " Where:"
echo " <config.file> = contains specific job details (see below)"
echo " OUTPUTDIR = is path to output data directory"
echo ""
echo " Note: Modify the values in CONFIG_FILE to suit compute cluster and "
echo " input data size and nameing conventions:"
echo ""
echo " <config.file> contains data and job input details and user defined variables "
echo " and user and cluster specific options:"
echo " UEMAIL, DATADIRECTORY, OUTPUTDIR, JOBPREFIX, ACCOUNT "
echo " STANDARD_JOB_DETAILS"
echo " per job details:"
echo " NCPU, WALLTIME, MEM, MEMDIR, NUMPERARRAYITEM"
echo ""
}
######################################################################################################################
### Function to return the PBS header information, depending on PBS type.
######################################################################################################################
# NODESCPUS=$(F_GETNODESTRING $1 $MEM $NCPU large $WALLTIME $JOBNAME $ACCOUNT $PBSUSER $MODTRINITY $JOBPREFIX)
# NODESCPUS=$(F_GETNODESTRING $1 $2 $3 $4 $5 $6 $7 $8 $9 ${10} )
function F_GETNODESTRING {
if [[ $1 = "--pbspro" ]] ; then
echo "
#PBS -l select=1:ncpus="$3":NodeType="$4":mem="$2"
#PBS -l walltime="$5"
#PBS -N "$6"
"$7"
#PBS -j oe
#PBS -m a
#PBS -V
"$8"
"$9"
"
elif [[ $1 = "--pbs" ]] ; then
echo "
#PBS -l nodes=1:ppn="$3"
#PBS -l vmem="$2"
#PBS -l walltime="$5"
#PBS -N "$6"
#PBS -j oe
#PBS -m a
"$8"
#PBS -V
"$9"
"
fi
echo " JOBNAME=$6"
echo " JOBPREFIX=${10}"
}
######################################################################################################################
### Do some checking that files exist etc.
######################################################################################################################
#DS=$(F_GETNODESTRING $FILENAMEINPUT $DATADIRECTORY $FILENAMESINGLE $FILENAMELEFT $FILENAMERIGHT)
# DS=$(F_GETNODESTRING $1 $2 $3 $4 $5 )
function SET_DS {
# add the correct filename extension so we can check if inchworm has been run in part 3 below
if [[ "$1" == *FR* ]] || [[ "$1" == *RF* ]] ;
then
DS="."
else
DS=".DS."
fi
}
#AP: i removed this because a) it didn't stop the script from progressing when there was an error, b) it was not handling multiple input files
function F_CHECKFILES {
# Check that input data file(s) exist.
if [[ "$1" == *--single* ]] ; then
if [ ! -f ""$2""$3"" ] ; then
echo "Input file does not exist: "
echo " "$2""$3""
exit 1
fi
else # check that both left and right filenames exist
if [ ! -f ""$2""$4"" ] ; then
echo "Input file does not exist: "
echo " "$2""$4""
exit 1
fi
if [ ! -f ""$2""$5"" ] ; then
echo "Input file does not exist: "
echo " "$2""$5""
exit 1
fi
fi
}
######################################################################################################################
### Checking that files containing stage specific script data exist
######################################################################################################################
#F_WRITESCRIPT( scriptname $SOURCENAME )
#F_WRITESCRIPT( $1 $2 )
function F_WRITESCRIPT {
if [ -e "$2" ] ; then
source "$2"
else
echo ""$1" requires file \""$2"\" to be present in the current directory"
exit 1
fi
}
##################################################################################################################################
# This is used to stop all jobs sent to the PBS queue
# requires path to the filename as second argument
# The order of the following tests is important.
##################################################################################################################################
if [[ "$1" = "--rm" ]] || [[ "$1" = "-rm" ]] ; then
if [[ -e $2/jobnumbers.out ]] ; then
cat $2/jobnumbers.out | while read LINE; do
qdel $LINE || { echo "continuing..." ;}
done
#echo " Any parallel "
else
echo " Could not stop jobs as could not open file: "
echo " $2"jobnumbers.out""
fi
exit 0
fi
if [[ "$1" = "--help" ]] || [[ "$1" = "-h" ]] || [[ "$1" = "-?" ]]; then
F_USAGE
exit 0
fi
##################################################################################################################################
## User email information required from command line:
## Provide a valid email address so PBS can email user on start and finish of execution of individual parts (not part 4b or 5b though)
##################################################################################################################################
if [[ ! -e "$1" ]] ; then
echo "input file does not exist: "$1""
echo "Please provide an input file"
F_USAGE
exit 0
fi
|