Skip to content

Instantly share code, notes, and snippets.

@MattHarrington
Created February 6, 2018 19:28
Show Gist options
  • Save MattHarrington/53f18048603aee7155d0f1ee6698353f to your computer and use it in GitHub Desktop.
Save MattHarrington/53f18048603aee7155d0f1ee6698353f to your computer and use it in GitHub Desktop.
Display SGE statistics
#!/bin/sh
#
# Probably written by someone in the Shoichet lab. Maybe Teague?
# Save and then run with "sh sgestat.sh" or "chmod +x sgestat.sh" and
# then "./sgestat.sh". -MH 06-Feb-2018
#
# This file is not located here on hook (sgehead) at UofT.
#
#if [ ! -e "/opt/sge" ]; then
# echo ssh to sgehead;
# exit;
#fi
echo -n "Nodes alive: "
qhost | grep -v -e ' - ' -e '-----' -e 'HOSTNAME' | wc -l
qhost | grep -v -e ' - ' -e '-----' -e 'HOSTNAME' | awk 'BEGIN{X=0}{X+=strtonum($3)}END{print "CPUs: " X}'
qhost | grep -v -e ' - ' -e '-----' -e 'HOSTNAME' | awk 'BEGIN{X=0}{X+=strtonum($4)}END{print "Total Load: " X}'
echo "Nodes dead: "
qhost | grep ' - ' | grep -v -e '-----' -e 'HOSTNAME' -e global | awk '{print $1}'
echo "Running per user: "
#qstat | awk '{print $4}' | sort | grep -v -e '^$' -e user | uniq -c | sort -n
qstat -u '*' -g d | awk '{print $4,$5}' | sort | grep -v -e '^ $' -e user | grep 'r$' | uniq -c | sort -nr
echo "Queued per user: "
qstat -u '*' -g d | awk '{print $4,$5}' | sort | grep -v -e '^ $' -e user | grep 'qw$' | uniq -c | sort -nr
echo "Other per user: "
qstat -u '*' -g d | awk '{print $4,$5}' | sort | grep -v -e '^ $' -e user | grep -v -e 'qw$' -e 'r$' | uniq -c | sort -nr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment