diff options
author | Justin Bedo <cu@cua0.org> | 2018-11-26 15:37:02 +1100 |
---|---|---|
committer | Justin Bedo <cu@cua0.org> | 2018-11-26 15:44:30 +1100 |
commit | ce004fd8f1993810081076dcf215f872c40a5655 (patch) | |
tree | cc66901525b59600682b421c29420da40f532593 /lib | |
parent | ef0386b2137117578560d4ee83f2b7281b929040 (diff) |
qsub: let sleep timing be configurable
Diffstat (limited to 'lib')
-rw-r--r-- | lib/qsub.nix | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/lib/qsub.nix b/lib/qsub.nix index 438dd56..bb4934a 100644 --- a/lib/qsub.nix +++ b/lib/qsub.nix @@ -1,12 +1,12 @@ {stdenv, lib, writeScript}: -{ ppn ? 1, mem ? 1, walltime ? "24:00:00", tmpDir ? "/tmp" }: drv: lib.overrideDerivation drv ({ args, builder, name, ... }: { +{ ppn ? 1, mem ? 1, walltime ? "24:00:00", tmpDir ? "/tmp" , sleepTime ? 60}: drv: lib.overrideDerivation drv ({ args, builder, name, ... }: { builder = "/bin/bash"; args = let script = writeScript "qsub-script" '' #!${stdenv.shell} while [ ! -e ${tmpDir}/$PBS_JOBID ] ; do - sleep 5 + sleep ${toString sleepTime} done TMPDIR=${tmpDir}/$PBS_JOBID TEMP=$TMPDIR @@ -34,13 +34,13 @@ if ! grep "Please retry" id > /dev/null ; then exit 1 fi - sleep 60 + sleep ${toString sleepTime} done id=$(cat id) function cleanup { qdel $id 2>/dev/null || true - sleep 5 + sleep ${toString sleepTime} rm -rf ${tmpDir}/$id } trap cleanup INT TERM EXIT @@ -48,7 +48,7 @@ cp -r $TMPDIR ${tmpDir}/$id set > ${tmpDir}/$id/nix-set until qstat -f ''${id%%.} 2>&1 | grep "\(Unknown Job\|job_state = C\)" > /dev/null ; do - sleep 60 + sleep ${toString sleepTime} done cat ${tmpDir}/$id/qsub-stderr >&2 cat ${tmpDir}/$id/qsub-stdout |