Skip to content
Snippets Groups Projects
Commit 161310a1 authored by Julien  GUGLIELMINI's avatar Julien GUGLIELMINI
Browse files

Added more checks for the sbatch version (scratch folder existence, number of...

Added more checks for the sbatch version (scratch folder existence, number of threads for the main script)
parent d57d1088
No related branches found
No related tags found
No related merge requests found
......@@ -7,7 +7,7 @@ trap 'rm -rf "$tmp"' EXIT
export LC_ALL=C
SECONDS=0
readonly VERSION=1.4
readonly VERSION=1.4.1
bold=$(tput bold)
green=$(tput setaf 2)
......@@ -136,7 +136,7 @@ while getopts :fTsji:p:o:t:a:m:l:C:I: option ; do
case $option in
i) PRT="$OPTARG"; if [[ ! -s $PRT ]]; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "Fasta file '$PRT' not found or empty (option -i)." ; exit 1 ; fi ;;
p) MMPATH="$OPTARG" ;;
o) OUT="$OPTARG"; if [[ -f "$OUT".wgrr.final.txt ]]; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "File $OUT.wgrr.final.txt already exists. Change option -o or remove this file and relaunch." ; exit 1 ; fi ;;
o) OUT="$OPTARG"; if [[ -f "$OUT".wgrr.final.txt ]]; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "File $OUT.wgrr.final.txt already exists. Change option -o or remove this file and relaunch." ; exit 1 ; elif [[ ${OUT} =~ / ]] ; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "You cannot use a path as a prefix with -o option. Please use a simple string instead." ; exit 1 ; fi ;;
t) THREADS="$OPTARG"; if [[ ! $THREADS =~ ^[0-9]+$ ]]; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "Number of threads $THREADS must be an integer (option -t)." ; exit 1 ; fi ;;
a) ARRAYSIZE="$OPTARG"; if [[ ! $ARRAYSIZE =~ ^[0-9]+$ ]]; then if [[ $ARRAYSIZE != "AUTO" ]] ; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "Number of genomes comparisons $ARRAYSIZE must be an integer (option -a)." ; exit 1 ; fi ; fi ;;
l) IDLIST="$OPTARG"; if [[ ! -s ${IDLIST} ]] ; then printf "${bold}${red}%-17s -- %s\n${normal}" "[ERROR]" "File ${IDLIST} not found or empty (option -l)." ; exit 1 ; fi ;;
......@@ -180,7 +180,10 @@ if [[ $? -eq 1 ]] ; then
tmp=$(mktemp -d tmp-XXXXXX)
else
if [[ `hostname` == "maestro-"* ]] ; then
tmp=$(mktemp -p $MYSCRATCH -d tmp-XXXXXXXX)
if [[ ! -d ${APPASCRATCH}/${USER} ]] ; then
mkdir ${APPASCRATCH}/${USER}
fi
tmp=$(mktemp -p ${APPASCRATCH}/${USER} -d tmp-XXXXXXXX)
else
tmp=$(mktemp -d tmp-XXXXXXXX)
fi
......@@ -198,7 +201,7 @@ fi
# Get system total memory if not in sbatch
TOTALMEM=0
if [[ $BATCHFLAG==0 ]] ; then
if [[ $BATCHFLAG == 0 ]] ; then
if [[ $SLURM_JOBID != "" ]] ; then
TOTALMEM=$(sacct -j $SLURM_JOBID -o ReqMem | awk 'NR==3{print $1;exit}' | numfmt --from=iec)
else
......@@ -212,6 +215,9 @@ if [[ $BATCHFLAG==0 ]] ; then
fi
fi
fi
elif [[ $(nproc) -gt 1 ]] ; then
printf "${bold}${yellow}%-17s -- %s\n${normal}" "[WARNING]" "You requested $(nproc) threads (sbatch -c $(nproc)) but wGRR main script will use only one in sbatch mode." | tee -a ${OUT}.wgrr.log
printf "${bold}${yellow}%-17s -- %s\n${normal}" "[WARNING]" "You should not use the -c option of sbatch when running wGRR this way." | tee -a ${OUT}.wgrr.log
fi
printf "%-17s -- %s\n" "["$(textifyDuration $SECONDS)"]" "wGRR version ${VERSION}" | tee -a ${OUT}.wgrr.log
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment