Compare commits

..

No commits in common. "6d1a2e9759325c8fe9aaf4bf41efdf44aa7aa5ef" and "fd6c9867f27d96df7c0f13adebf8bd897a60456c" have entirely different histories.

2 changed files with 2 additions and 77 deletions

View File

@ -1,75 +0,0 @@
#!/bin/bash
# This job script takes a nap for 10 seconds (or paramter $2) every 30 minutes (or paramter $1)
# SGE options
#$ -N PSleeper
#$ -l scf=1M,mem=100M,h_vmem=100M
#$ -q normal.q
#$ -cwd
# process args
case "$1" in
-h)
echo "usage: $0 [-h | [-d] [T] [nap]]"
echo "periodically take a nap"
echo ""
echo "-h print this help and exit"
echo "-d print debug info"
echo "T take a nap every T minutes (default: 30)"
echo "nap take a nap for nap seconds (default: 10)"
exit 1
;;
*)
debug=0
terse="-terse"
debug_flag=""
do_echo=0
T=30
nap=10
while (( "$#" )); do
case "$1" in
-d)
debug=1
terse=""
debug_flag="-d"
do_echo=1
;;
*)
T=${1:-30}
nap=${2:-10}
break
;;
esac
shift
done
;;
esac
# set other variables
next=$(date -d "${T} minutes" +%Y%m%d%H%M)
script=/opt/SGE/examples/jobs/periodic_sleeper.sh
# output some informations
if [ ${debug} -eq 1 ]; then
echo "T = ${T}, nap=${nap}"
echo "next run at ${next} (YYYYMMDDhhmm)"
echo "debug_flag = ${debug_flag}, do_echo = ${do_echo}"
echo ""
fi
# commands to run in Grid Engine
/opt/SGE/examples/jobs/sleeper.sh ${nap} ${do_echo}
# re-submit script to execute in T minutes
jobid=$(qsub ${terse} -a ${next} ${script} ${debug_flag} ${T} ${nap})
exit_code=$?
if [ ${debug} -eq 1 ]; then
echo "${jobid}"
fi
if [ ${exit_code} -ne 0 ]; then
if [ ${debug} -eq 1 ]; then
echo "${jobid}"
echo "Ups, something went wrong, check output!"
fi
exit ${exit_code}
fi

View File

@ -35,7 +35,7 @@ function clean_up() {
### get requested number of GPU's
# use hard resource list first
NGPUS=$(qstat -j ${JOB_ID} 2>/dev/null | sed -n "s/hard resource_list:.*gpu=\([[:digit:]]\+\).*/\1/p")
NGPUS=$(qstat -j ${JOB_ID} | sed -n "s/hard resource_list:.*gpu=\([[:digit:]]\+\).*/\1/p")
# set NGPUS to zero if empty
if [ -z "${NGPUS}" ] ; then
NGPUS=0
@ -68,4 +68,4 @@ else
fi
# clean exit
exit 0
exit 0