December 19, 2019
Justin C. Bagley, Ph.D.
University of Missouri-St. Louis (UMSL)
Virginia Commonwealth University (VCU)
This is the myq
function, which I wrote at VCU on May 7, 2018, in order to automate quickly providing improved queue statistics from the command line while using VCU's godel supercomputer. The godel cluster uses a Torque/PBS resource management system, and this takes place of godel's qstat
command (common to these types of systems). myq
may not work without qrsh
-ing onto a compute
node.
Usage: $ myq
.
Here is the function:
myq () {
#
calc () {
bc -l <<< "$@"
}
#
echo "------------------------------------------------";
echo QUEUE STATISTICS for $(date);
echo "------------------------------------------------";
#
MY_QSTAT_LINES="$(qstat | wc -l)";
MY_NUM_JOBS="$(calc $MY_QSTAT_LINES - 2 )";
echo "Current number of jobs: $MY_NUM_JOBS";
#
MY_RUNNING_JOBS="$(qstat | grep -h '\ r\ ' | wc -l)";
MY_PROPORTION_RUNNING="$(calc $MY_RUNNING_JOBS / $MY_NUM_JOBS)";
MY_PERCENT_RUNNING="$(calc $MY_PROPORTION_RUNNING*100 | sed 's/\(\.[0-9]\)[0-9]*/\1/g')";
echo "Running jobs: $MY_RUNNING_JOBS ($MY_PERCENT_RUNNING%)";
#
ADDING_MY_SLOT_SIZES="$(qstat | grep -h '\ r\ ' | sed 's/^[0-9]*\ [0-9\.A-Za-z]*\ .*godel[0-9]*\ //g' | sed 's/\ //g' | sed 's/$/+/g' | tr -d '\n' | sed 's/\+$//')";
MY_SLOT_SIZE_TOTAL="$(calc $ADDING_MY_SLOT_SIZES)";
MY_PROPORTION_SLOTS="$(calc $MY_SLOT_SIZE_TOTAL / 200)";
MY_PERCENT_SLOTS="$(calc $MY_PROPORTION_SLOTS*100 | sed 's/\(\.[0-9]\)[0-9]*/\1/g')";
echo "Current slot use: $MY_SLOT_SIZE_TOTAL ($MY_PERCENT_SLOTS%)";
MY_REMAINING_SLOTS="$(calc 200 - $MY_SLOT_SIZE_TOTAL)";
echo "Remaining slots: $MY_REMAINING_SLOTS";
#
echo "";
#
qstat;
#
}