From efd72eb3a66346ffcba9a7ee11935586ba0855fc Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Wed, 24 Nov 2021 12:46:02 +0000
Subject: [PATCH] BF: Couple of typos. Check fsl_sub exit code

---
 eddy/runEddy | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/eddy/runEddy b/eddy/runEddy
index 28f5c37..f62eb94 100755
--- a/eddy/runEddy
+++ b/eddy/runEddy
@@ -25,7 +25,7 @@ set -e
 # eddy. Don't pass the --out option, as that is
 # added by this script.
 exedir="$1"; shift;
-outdir="$2"; shift;
+outdir="$1"; shift;
 eddy_args="$@"
 
 # Find all eddy_cuda* executables
@@ -58,6 +58,10 @@ do
   tmp=`basename ${cuda_exe}`
   variant=`echo ${tmp} | sed 's/eddy_//'`
   jid=`fsl_sub -l ${outdir} -q cuda.q ${cuda_exe} --out=${outdir}/eddyOutput_${variant} ${eddy_args}`
+  if [ $? -ne 0 ]; then
+    echo "Error submitting ${cuda_exe} ${cuda_args}"
+    exit 1
+  fi
   cuda_jids="${cuda_jids} ${jid}"
 done
 
@@ -67,6 +71,10 @@ do
   tmp=`basename ${cuda_exe}`
   variant=`echo ${tmp} | sed 's/eddy_//'`
   jid=`fsl_sub -l ${outdir} -q long.q -s openmp,6 ${cpu_exe} --out=${outdir}/eddyOutput_${variant} ${eddy_args}`
+  if [ $? -ne 0 ]; then
+    echo "Error submitting ${cuda_exe} ${cuda_args}"
+    exit 1
+  fi    
   cpu_jids="${cpu_jids} ${jid}"
 done
 
@@ -81,7 +89,7 @@ if [ ! -z "${SGE_ROOT}" ]; then
   # on the queue for CPU jobs
   for jid in ${cpu_jids}; do
     qalter ${jid} -R y
-  fi
+  done
 
   # wait for all jobs to finish
   while [ : ]; do
-- 
GitLab