old jobs removal

This commit is contained in:
ville rantanen
2014-09-03 13:23:03 +03:00
parent 3f3159b23e
commit cba2e4f5ef
4 changed files with 27 additions and 7 deletions

View File

@@ -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