aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorl-d-s <distefano.l@wehi.edu.au>2018-12-11 14:17:22 +1100
committerl-d-s <distefano.l@wehi.edu.au>2018-12-11 14:17:22 +1100
commitf0357e09b8c473b55d22c4632692fcc79021570d (patch)
tree9c92993d1f0c788a162159e6440ea958eae3e35d /lib
parent6742864b8f92f5d7d56da4901486b7e83a271e23 (diff)
parent10bdecf6c1338d7f531ddf7b41da14dfe4a4ac33 (diff)
Merge branch 'master' of https://github.com/PapenfussLab/bionix
Diffstat (limited to 'lib')
-rw-r--r--lib/qsub.nix22
1 files changed, 11 insertions, 11 deletions
diff --git a/lib/qsub.nix b/lib/qsub.nix
index 4ef6dbc..f7b3c3e 100644
--- a/lib/qsub.nix
+++ b/lib/qsub.nix
@@ -5,17 +5,17 @@
args = let
script = writeScript "qsub-script" ''
#!${stdenv.shell}
- while [ ! -e ${tmpDir}/$PBS_JOBID ] ; do
+ while [ ! -e ${tmpDir}/qsub-$PBS_JOBID ] ; do
sleep ${toString sleepTime}
done
- TMPDIR=${tmpDir}/$PBS_JOBID
+ set -a
+ . ${tmpDir}/qsub-$PBS_JOBID/nix-set
+ set +a
+ TMPDIR=${tmpDir}/qsub-$PBS_JOBID
TEMP=$TMPDIR
TMP=$TMPDIR
NIX_BUILD_TOP=$TMPDIR
cd $TMPDIR
- set -a
- . nix-set
- set +a
${builder} ${lib.escapeShellArgs args} > qsub-stdout 2> qsub-stderr
echo $? > qsub-exit
'';
@@ -46,15 +46,15 @@
}
trap cleanup INT TERM EXIT
- cp -r $TMPDIR ${tmpDir}/$id
- set > ${tmpDir}/$id/nix-set
+ cp -r $TMPDIR ${tmpDir}/qsub-$id
+ set > ${tmpDir}/qsub-$id/nix-set
until qstat -f ''${id%%.} 2>&1 | grep "\(Unknown Job\|job_state = C\)" > /dev/null ; do
sleep ${toString sleepTime}
done
- cat ${tmpDir}/$id/qsub-stderr >&2
- cat ${tmpDir}/$id/qsub-stdout
- if [ -e ${tmpDir}/$id/qsub-exit ]; then
- exitCode=$(cat ${tmpDir}/$id/qsub-exit)
+ cat ${tmpDir}/qsub-$id/qsub-stderr >&2
+ cat ${tmpDir}/qsub-$id/qsub-stdout
+ if [ -e ${tmpDir}/qsub-$id/qsub-exit ]; then
+ exitCode=$(cat ${tmpDir}/qsub-$id/qsub-exit)
else
exitCode=1
fi