Created
December 18, 2018 11:07
-
-
Save ndevenish/92924bfbe29b645cccbb904ff0fba0de to your computer and use it in GitHub Desktop.
Small script to monitor qsub whilst waiting for jobs to finish
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Start a monitor thread | |
( | |
wc=0 | |
while true | |
do | |
sleep 5 | |
## Attempt at being clever with qstat - but problem with | |
## normal "job x finished" output bumping the offset. Ideally | |
## I'd also capture those and use them as a refresh signal | |
# if [[ $wc -gt 0 ]]; then | |
# printf "\u001b[${wc}A" | |
# # Print blank | |
# echo "$qso" | sed 's/./ /g' | |
# # Move up again | |
# printf "\u001b[${wc}A" | |
# fi | |
# qso="$(qstat)" | |
# wc=$(echo "$qso" | wc -l) | |
# echo "${qso}" | |
qstat | |
sleep 5 | |
done | |
)& | |
monitor=$! | |
set -x | |
qsub -t $SAMPLE_RANGE -e /dev/null -sync y ./run_ana.sh | |
set +x | |
echo "Finished. Killing monitor thread." | |
kill $monitor | |
wait $monitor 2>/dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment