From ce004fd8f1993810081076dcf215f872c40a5655 Mon Sep 17 00:00:00 2001 From: Justin Bedo Date: Mon, 26 Nov 2018 15:37:02 +1100 Subject: qsub: let sleep timing be configurable --- lib/qsub.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3