Graham Tips: Difference between revisions
Jump to navigation
Jump to search
(Adding some functions and aliases to the Graham page) |
mNo edit summary |
||
Line 1: | Line 1: | ||
'''''Note''''' This page is still being developed. | |||
== ~/.bashrc == | == ~/.bashrc == |
Revision as of 13:09, 20 December 2017
Note This page is still being developed.
~/.bashrc
Show Total Allocation Usage
alias sqs='sshare -a -A ctb-mmstastn_cpu -A rrg-mmstastn_cpu'
Give Job Details
# Slurm Control for job
function scj() {
scontrol show jobid -dd $1
}
export -f scj
# Slurm account for job
function saj() {
sacct --format=jobid,JobName,ncpus,ntasks,state,reserved,elapsed,End,AveVMSize,MaxRSS,ReqMem -j $1
}
export -f saj
# Slurm statistics for job
function ssj() {
sstat --format=jobid,ntasks,AveRSS,MaxRSS,MaxRSSNode -j $1
}
export -f ssj
function job_summary() {
scj $1;
saj $1;
ssj $1;
}
export -f job_summary
Show List of Submitted Jobs
sq_hist defaults to showing the jobs submitted in the last week. Option argument is of the form YYYY-MM-DD.
function sq_hist() {
# Date for one week ago
dt=$(perl -e 'use POSIX;print strftime "%Y-%m-%d",localtime time-604800;')
# If argument given (YYYY-MM-DD), use that. Else default to last week.
TIME=${1:-${dt}};
echo $TIME;
sacct --starttime ${TIME} --format=jobid,jobname,reserved,alloccpus,state,exitcode | grep -v extern | grep -v batch | grep -v orted | grep -v bash;
}
export -f sq_hist
Move to Directory of Currently-Running Job
function cdJob() {
pth=$(squeue -o %Z -j $1 | sed '1d')
echo "cd-ing to ${pth}"
cd ${pth}
}
export -f cdJob
Show Current Usage of Group Allocation
# How busy is our resource allocation
function nodeUsage() {
jobsR=`squeue --account=ctb-mmstastn_cpu,rrg-mmstastn_cpu -o %C -t R`
jobsP=`squeue --account=ctb-mmstastn_cpu,rrg-mmstastn_cpu -o %C -t PD`
cpuSUM_R=0
cpuSUM_P=0
count=0
IFS='
'
for x in $jobsR;
do
if [ "$count" -gt "0" ]; then
cpuSUM_R=$((x + cpuSUM_R));
else
count=1;
fi
done
count=0;
IFS='
'
for x in $jobsP;
do
if [ "$count" -gt "0" ]; then
cpuSUM_P=$((x + cpuSUM_P));
else
count=1;
fi
done
echo -n $cpuSUM_R;
echo -n " of 832 processors are being used (";
echo -n $((832 - cpuSUM_R));
echo " currently unused)."
echo -n $cpuSUM_P;
echo " processors-worth of jobs are pending";
}
export -f nodeUsage