[torqueusers] Script to extract working directory for running jobs
Yaroslav Halchenko
maui at onerussian.com
Thu Feb 9 19:58:58 MST 2006
Here is my list of bashizms...
which are
1. quite shorter
2. has just a single invocation to qstat (which is quite important if
you have a long list of jobs)
3. take care about dewarping of qstatf:-)
So for your purpose do something like
(feel free to alias it, or make a function and feed its arguments to
qstatf, so you could work just on a list of job ids)
qstatf | prejobid | qstatfi PBS_O_WORKDIR
where
# Just qstat -f with warping removed
qstatf () { qstat -f $*| tr '\n' '&' | sed -e 's/&\t//g' | tr '&' '\n'; }
# to get Job Id: and prepend each line with it
alias prejobid="awk '/^Job Id:/{ id=\$3; }{ print id, \$0; }'"
# select a field
qstatfi() { grep -e "$*" | sed -e "s/^\(\S*\).*,$*=\([^,]*\).*/\1 \2/g" ;}
The other scripts I use
# Output Path
qstatfO() { qstatf $* | grep Output | awk '{print $3;}'; }
# Execution host
qstatfE() { qstatf $* | grep exec_host | awk '{print $3;}'; }
# Dumps output as of now for specified job #
qstatfOU() {
for j in $*; do
ex=`qstatfE $j`;
echo "JOB $j:$ex"
rsh ${ex%%/*} cat /var/spool/torque/spool/${j}*;
done
}
# Filter qstat by a list of keywords
qstatgrep ()
{
cmd=""
for pat in $*; do cmd="$cmd | grep -e $pat"; done
eval "qstat $cmd"
}
# filter and show just a job number field
qstatgrepj ()
{
qstatgrep $* | f1
}
--
Yaroslav Halchenko
Research Assistant, Psychology Department, Rutgers-Newark
Office: (973) 353-5440x263 | FWD: 82823 | Fax: (973) 353-1171
101 Warren Str, Smith Hall, Rm 4-105, Newark NJ 07105
Student Ph.D. @ CS Dept. NJIT
More information about the torqueusers
mailing list