From cba2e4f5efe53d2d7a60507c0e8e856d782d8f5c Mon Sep 17 00:00:00 2001 From: ville rantanen Date: Wed, 3 Sep 2014 13:23:03 +0300 Subject: [PATCH] old jobs removal --- anduril/slurm-maxfree | 14 ++++++++++---- anduril/slurm-random | 14 +++++++++++++- foldermenu.py | 2 +- qcd_function | 4 +++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/anduril/slurm-maxfree b/anduril/slurm-maxfree index 599f0ad..4ab00e6 100755 --- a/anduril/slurm-maxfree +++ b/anduril/slurm-maxfree @@ -100,10 +100,16 @@ echo 'EC=$?' >> "$JOBFILE" echo "date +'Stop: %s' >> \"$STATFILE\" " >> "$JOBFILE" echo 'exit $EC' >> "$JOBFILE" +# clear out old job definitions (semirandomly) +( +[[ -e "$JOBROOT"/.lastdel ]] || touch "$JOBROOT"/.lastdel +if test "$( find $JOBROOT/.lastdel -mmin +30 )" +then touch "$JOBROOT"/.lastdel + find "$JOBROOT" -maxdepth 2 -mindepth 2 -type f -mtime +10 -delete + find "$JOBROOT" -type d -depth -empty -delete +fi +) & + echo "The job file is in $JOBFILE" # send the job srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" - - - - diff --git a/anduril/slurm-random b/anduril/slurm-random index 472367a..1d6e7ff 100755 --- a/anduril/slurm-random +++ b/anduril/slurm-random @@ -72,7 +72,7 @@ do if [[ "${!i}" == */_command ]] do [ -f "'${!i}'" ] && { break } || { - echo Waiting for _command file "'${!i}'" + echo Waiting for _command file '${!i}' retrys=$(( $retrys + 1 )) sleep 1; [ "$retrys" -gt 15 ] && break; } @@ -95,6 +95,18 @@ echo 'EC=$?' >> "$JOBFILE" echo "date +'Stop: %s' >> \"$STATFILE\" " >> "$JOBFILE" echo 'exit $EC' >> "$JOBFILE" +# clear out old job definitions (semirandomly) +( +[[ -e "$JOBROOT"/.lastdel ]] || touch "$JOBROOT"/.lastdel +if test "$( find $JOBROOT/.lastdel -mmin +30 )" +then touch "$JOBROOT"/.lastdel + find "$JOBROOT" -maxdepth 2 -mindepth 2 -type f -mtime +10 -delete + find "$JOBROOT" -type d -depth -empty -delete +fi +) & + echo "The job file is in $JOBFILE" # send the job srun --nodelist=${NODELIST[$INDEX]} "$JOBFILE" + +wait diff --git a/foldermenu.py b/foldermenu.py index cdfaabb..e170e7b 100755 --- a/foldermenu.py +++ b/foldermenu.py @@ -329,7 +329,7 @@ class entry_collection: else: subprocess.call(command_str, stderr=subprocess.STDOUT, shell=True,executable="/bin/bash") except: - print('Unable to run: "'+command_str+'"') + print('Non-zero exit code: "'+command_str+'"') if (self.options.command or self.options.once or bg): wait=False diff --git a/qcd_function b/qcd_function index 1e0c2e2..d4180b5 100644 --- a/qcd_function +++ b/qcd_function @@ -146,6 +146,7 @@ function whenfilechanges() { } local fname + local forced local otime local ntime local i @@ -174,7 +175,8 @@ function whenfilechanges() { date } done - sleep 2 + read -t 2 forced + [ $? -eq 0 ] && eval "$@" done }