Last active
August 29, 2015 13:57
-
-
Save nmpowell/9573804 to your computer and use it in GitHub Desktop.
Summarise Sun Grid Engine (SGE) qstat contents for the current user (and save output to a file)
This file contains 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
function qs() { | |
# Also use qs as shortcut to qstat -j | |
if [ $# -gt 0 ] | |
then | |
jobNum=$1 | |
qstat -j ${jobNum} | |
fi | |
# Just one call to qstat; "double quotes" around "${qstat_contents}" below maintain the line breaks | |
qstat_contents=`qstat -u "*"` | |
quser=`echo "${qstat_contents}" | grep "${USER}"` | |
qnum=`echo "${quser}" | wc -l` | |
qrnum=`echo "${quser}" | grep " r " | wc -l` | |
qwnum=`echo "${quser}" | grep " qw " | wc -l` | |
hqwnum=`echo "${quser}" | grep " hqw " | wc -l` | |
totalqnum=`echo "${qstat_contents}" | grep ":" | wc -l` | |
echo "running: ${qrnum} | waiting: ${qwnum} | hold-waiting: ${hqwnum} | total: ${qnum} | (total all users: ${totalqnum})" | |
# Also echo to an output file | |
QS_OUTPUT_FILE=/home/${USER}/logs/qs_output.csv | |
echo "$(date +%Y-%m-%d),$(date +%T),${qrnum},${qwnum},${hqwnum},${qnum},${totalqnum}" >> ${QS_OUTPUT_FILE} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment