Skip to content

Shane's shell tips

Shane Neph edited this page Oct 9, 2023 · 13 revisions

.bashrc tips found in ~sjn/.bashrc

sc() {
  params=""
  if (( $# != 0 )); then
    params="-p $1"
  fi
  squeue $params -o '%.8u %.2t %.6C %R' --noheader --array | awk -v me=`whoami` 'BEGIN {mecntr=0;waitcntr=0;allwaitcntr=0;smartcntr=0;neversatisfiedcntr=0;allsmartcntr=0;allneversatisfiedcntr=0;allnum=0} {num=$3; allnum+=num; if ($2~/R/) {  } if ($2 ~/PD/) {allwaitcntr+=num; if ($4~/Dependency/ || $4~/JobHeld/) allsmartcntr+=num; if ($4~/DependencyNeverSatisfied/) allneversatisfiedcntr+=num; } if ($1 == me) { mecntr+=num; if ($2~/PD/) {waitcntr+=num; if ($4~/Dependency/ || $4~/JobHeldUser/) smartcntr+=num; if ($4~/DependencyNeverSatisfied/) neversatisfiedcntr+=num; } } } END { print " All Jobs: " allnum; print "   Running: " allnum-allwaitcntr; print "   Waiting: " allwaitcntr; print "      Resource: " allwaitcntr-allsmartcntr; print "      Designed: " allsmartcntr; print "      Orphaned: " allneversatisfiedcntr; print " My Jobs: " mecntr; print "   Running: " mecntr-waitcntr; print "   Waiting: " waitcntr; print "      Resource: " waitcntr-smartcntr; print "      Designed: " smartcntr; print "      Orphaned: " neversatisfiedcntr; }' &&  date;
}

sc0() { sc compute; }
sc1() { sc ckpt; }

cluster-wide

> sc

sc-all

specific to the compute partition

> sc0

sc-compute

Clone this wiki locally