diff options
author | l-d-s <distefano.l@wehi.edu.au> | 2018-11-26 15:02:18 +1100 |
---|---|---|
committer | l-d-s <distefano.l@wehi.edu.au> | 2018-11-26 15:02:18 +1100 |
commit | 29aaf9458dc5b7fd77b8c62cdb51da8637112ab1 (patch) | |
tree | 228bff500d955d37e257e900fda3daa26f155a5c | |
parent | 8d0fecd85cec1c23e45d76917bdad072504e2998 (diff) | |
parent | 1a75f5789073c0a655fd20ba269e9509d773b1fc (diff) |
Merge branch 'master' of https://github.com/PapenfussLab/bionix
-rw-r--r-- | lib/qsub.nix | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/lib/qsub.nix b/lib/qsub.nix index f0b0660..d6a34fe 100644 --- a/lib/qsub.nix +++ b/lib/qsub.nix @@ -21,14 +21,14 @@ ''; qsub = writeScript "qsub" '' - #!/bin/bash + #!${stdenv.shell} PATH=/usr/bin:/bin:/usr/sbin:/sbin SHELL=/bin/sh NIX_BUILD_CORES=${toString ppn} id=$(qsub -l nodes=1:ppn=${toString ppn},mem=${toString mem}gb,walltime=${walltime} -N "${name}" ${script}) function cleanup { - qstat ''${id%%.} 2> /dev/null > /dev/null && qdel $id || true + qdel $id 2>/dev/null || true sleep 5 rm -rf ${tmpDir}/$id } @@ -36,12 +36,16 @@ cp -r $TMPDIR ${tmpDir}/$id set > ${tmpDir}/$id/nix-set - while qstat ''${id%%.} 2> /dev/null > /dev/null ; do - sleep 5 + until qstat -f ''${id%%.} 2>&1 | grep "\(Unknown Job\|job_state = C\)" > /dev/null ; do + sleep 60 done cat ${tmpDir}/$id/qsub-stderr >&2 cat ${tmpDir}/$id/qsub-stdout - exitCode=$(cat ${tmpDir}/$id/qsub-exit) + if [ -e ${tmpDir}/$id/qsub-exit ]; then + exitCode=$(cat ${tmpDir}/$id/qsub-exit) + else + exitCode=1 + fi exit $exitCode ''; |