Skip to content

Commit 511dba2

Browse files
committed
fisbatch -- removed --export option and check of screen test
sjeff, sueff, slogs -- extra cmd line args passed along to slurm command snodes -- handle longer node names docs/stubl_thumb.gif -- new logo
1 parent 0136851 commit 511dba2

File tree

6 files changed

+47
-27
lines changed

6 files changed

+47
-27
lines changed

bin/fisbatch

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,8 @@ fi
119119
# Submit the job and get the job id
120120
MyExport=SLURM_CPUS_PER_TASK,SLURM_JOB_NAME,SLURM_NTASKS_PER_NODE,SLURM_PRIO_PROCESS,SLURM_SUBMIT_DIR,SLURM_SUBMIT_HOST
121121
#JOB=`sbatch --export=$MyExport --job-name=FISBATCH --output=/dev/null --error=/dev/null $@ $BS 2>&1 | egrep -o -e "\b[0-9]+$"`
122-
JOB=`sbatch --export=$MyExport --job-name=FISBATCH --output=/dev/null --error=/dev/null $@ $BS 2>&1 | egrep -o -e "\b[0-9]+"`
122+
#JOB=`sbatch --export=$MyExport --job-name=FISBATCH --output=/dev/null --error=/dev/null $@ $BS 2>&1 | egrep -o -e "\b[0-9]+"`
123+
JOB=`sbatch --job-name=FISBATCH --output=/dev/null --error=/dev/null $@ $BS 2>&1 | egrep -o -e "\b[0-9]+"`
123124
JOB=`echo $JOB | awk '{ printf("%d", $1 + 0); }'`
124125

125126
# Make sure the job is always canceled
@@ -155,7 +156,8 @@ usr=`whoami`
155156
NODE=`squeue -h --clusters=${cluster} --partition=${partition} --jobs=${JOB} -o %N | grep -v "^CLUSTER"`
156157
NODE=`nodeset -e $NODE`
157158
for i in $NODE; do
158-
if [ `ssh $i "ps -ef | grep $usr | grep [S]CREEN | wc -l"` != "0" ]; then
159+
screenTest=`ssh $i "ps -ef | grep $usr | grep [S]CREEN | wc -l"`
160+
if [ "$screenTest" != "0" ]; then
159161
HNODE=$i
160162
break
161163
fi

bin/sjeff

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ if [ "$1" == "" -o "$1" == "--help" ]; then
1616
echo " list of jobids or --all for all "
1717
echo " running jobs. "
1818
echo " "
19+
echo " All other command line arguments are"
20+
echo " passed along to SLURM. For example: "
21+
echo " --partition and/or --clusters "
22+
echo " "
1923
echo " Environment Variables: "
2024
echo " STUBL_SJEFF_PCPU=(ps|top) "
2125
echo " "
@@ -32,16 +36,19 @@ if [ "$1" == "" -o "$1" == "--help" ]; then
3236
fi
3337

3438
if [ "$1" == "--all" ]; then
35-
jobList=`squeue -h --state='R' -o %A`
39+
jobList=`squeue -h $@ --state='R' -o %A | grep -v CLUSTER`
3640
else
3741
jobList=`echo $1 | tr ',' ' '`
3842
fi
3943

44+
# pop first arg off list, all others passed on to SLURM commands
45+
shift
46+
4047
#display header
4148
echo "Job_ID Username Efficiency Number_of_CPUs_In_Use"
4249

4350
for job in $jobList; do
44-
jobInfo=`squeue -h --job=$job --state='R' 2>/dev/null`
51+
jobInfo=`squeue -h $@ --job=$job --state='R' 2>/dev/null | grep -v CLUSTER`
4552

4653
if [ "$jobInfo" == "" -a "$1" != "--all" ]; then
4754
echo "Invalid job ID ($job)"
@@ -51,7 +58,7 @@ for job in $jobList; do
5158
nodelist=`nodeset -e $nodelist | tr ' ' ','`
5259

5360
# how many cpus were requested for the job
54-
ncpus=`squeue -h --job=$job -o %C`
61+
ncpus=`squeue -h $@ --job=$job -o %C | grep -v CLUSTER`
5562

5663
# accumulate efficiency of each requested cpu
5764
bStackedJobs=no
@@ -65,7 +72,7 @@ for job in $jobList; do
6572
if [ "$effsum" == "" ]; then
6673
effsum=0
6774
fi
68-
njobs=`squeue -h --nodes=$nodelist --user=$user -o %A | sort -u | wc -l`
75+
njobs=`squeue -h $@ --nodes=$nodelist --user=$user -o %A | grep -v CLUSTER |sort -u | wc -l`
6976
if [ "$njobs" -gt "1" ]; then
7077
bStackedJobs=yes
7178
fi

bin/slogs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ if [ "$1" == "--help" ]; then
3838
echo " For each job run after the given start date, the "
3939
echo " following information is gathered from the SLURM "
4040
echo " accounting logs: "
41-
echo " number of CPUS, start time, elapsed time, Amount "
42-
echo " of RAM Requested, Avg RAM Used, and Max RAM Used "
41+
echo " number of CPUS, wait time, start time, elapsed "
42+
echo " time, Amount of RAM Requested, Avg RAM Used, and "
43+
echo " Max RAM Used "
4344
echo ""
44-
echo " Usage: slogs [start_date] [users]"
45+
echo " Usage: slogs [start_date] [users] [sacct_args] "
4546
echo ""
4647
echo " Notes: start_date should be in MMDDYY format. "
4748
echo " Use a comma-separated list for multiple users."
49+
echo " All sacct_args passed along to sacct command. "
4850
echo ""
4951
echo " Defaults: "
5052
echo " start_date : 010113 if no start date is given. "
@@ -56,7 +58,7 @@ if [ "$1" == "--help" ]; then
5658
exit
5759
fi
5860

59-
# try to figure out is users are in first or second arg
61+
# try to figure out if users are in first or second arg
6062
if [ "$1" != "" -a "`echo $1 | tr ',' '\n' | head -n1 | xargs id 2>/dev/null | wc -l`" != 0 ]; then
6163
dol1=$2
6264
dol2=$1
@@ -65,35 +67,38 @@ else
6567
dol2=$2
6668
fi
6769

68-
if [ "$dol1" == "" ]; then
70+
dol1Test=`echo $dol1 | grep '\--' | wc -l`
71+
if [ "$dol1" == "" -o "$dol1Test" == "1" ]; then
6972
StartDate=010113
7073
else
7174
StartDate=$dol1
75+
shift
7276
fi
7377

7478
if [ "$dol2" == "" ]; then
7579
TheGroup=`whoami`
7680
else
7781
TheGroup=$dol2
82+
shift
7883
fi
7984
TheList=`echo "$TheGroup" | tr ',' ' '`
8085

8186
EndDate=`date +%m%d%y`
8287

83-
export SACCT_FORMAT="jobid,User,ncpus,start,elapsed,ReqMem,AveRSS,MaxRSS"
88+
export SACCT_FORMAT="jobid%20,User,ncpus,start,elapsed,ReqMem,AveRSS,MaxRSS"
8489

8590
TMPFILE=${TheGroup}_usage_logs_${StartDate}_to_${EndDate}.tmp
8691
OUTFILE=${TheGroup}_usage_logs_${StartDate}_to_${EndDate}.txt
8792

88-
echo "JobID User NCPUS Start Date Time Elapsed ReqMem AveRSS MaxRSS" > $TMPFILE
93+
echo "JobID User NCPUS Start Date Time Elapsed ReqMem AveRSS MaxRSS" > $TMPFILE
8994
for i in $TheList; do
9095
echo "Retrieving accouning data for user $i ..."
91-
sacct --start=${StartDate} --user=$i | \
92-
grep 'K' | \
93-
sed "s/\.bat+/ $i/g" | \
94-
sed "s/\.[0-9]*/& $i/g" | \
95-
sed "s/T/ /g" | \
96-
awk '{ printf("%-12s %-8s %5s %10s %8s %10s %8s %8s %8s\n", $1, $2, $3, $4, $5, $6, $7, $8, $9); }' \
96+
sacct --start=${StartDate} --user=$i $@ | \
97+
sed "s/$i//g" |
98+
sed "s/T/ /g" | \
99+
awk -vuser=$i '{
100+
printf("%-20s %-8s %5s %10s %8s %10s %8s %9s %9s\n", $1, user, $2, $3, $4, $5, $6, $7, $8, $9);
101+
}' \
97102
>> $TMPFILE
98103
done
99104

bin/snodes

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,17 +78,17 @@ fi
7878
# so use grep filter instead....
7979
if [ "$cluster" != "all" ]; then
8080
if [ "$3" == "mix" -o "$3" == "mixed" ]; then
81-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER" | head -n1
82-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER" | grep 'mix'
81+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER" | head -n1
82+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER" | grep 'mix'
8383
else
84-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER"
84+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep -v "^CLUSTER"
8585
fi
8686
else
8787
if [ "$3" == "mix" -o "$3" == "mixed" ]; then
88-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f" | head -n1
89-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep 'mix'
88+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f" | head -n1
89+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f" | grep 'mix'
9090
else
91-
sinfo $OPTIONS -o "%10n %8t %4c %8z %15C %8O %8m %8G %18P %f"
91+
sinfo $OPTIONS -o "%13n %8t %4c %8z %15C %8O %8m %8G %18P %f"
9292
fi
9393
fi
9494

bin/sueff

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ if [ "$1" == "" -o "$1" == "--help" ]; then
1111
echo " arg1 = userid (or comma-separated "
1212
echo " list of userids or --all for all "
1313
echo " users with currently active jobs. "
14+
echo " "
15+
echo " All other command line args will be "
16+
echo " passed along to SLURM. "
17+
echo " (e.g. --clusters, --partition, etc.)"
1418
echo "========================================"
1519
exit
1620
fi
@@ -21,19 +25,21 @@ else
2125
userList=`echo $1 | tr ',' ' '`
2226
fi
2327

28+
shift
29+
2430
#display header
2531
echo "Username Efficiency Number_of_CPUs_In_Use"
2632

2733
for user in $userList; do
28-
nodelist=`squeue -h --state='R' --user=$user -o %N | sort -u | tr '\n' ' '`
34+
nodelist=`squeue -h --state='R' --user=$user -o %N $@ | grep -v "CLUSTER" | sort -u | tr '\n' ' '`
2935

3036
if [ "$nodelist" == "" -a "$1" != "--all" ]; then
3137
echo "$user has no running jobs!"
3238
else
3339
nodelist=`nodeset -e $nodelist | tr ' ' ','`
3440

3541
# how many cpus were requested for the users jobs
36-
ncpus=`squeue -h --state='R' --user=$user -o %C | awk '{ SUM += $1;} END {print SUM }'`
42+
ncpus=`squeue -h --state='R' --user=$user -o %C $@ | grep -v "CLUSTER" | awk '{ SUM += $1;} END {print SUM }'`
3743

3844
# accumulate efficiency
3945
effsum=`clush -w $nodelist -N "ps -u $user -o pcpu= " 2>/dev/null | awk 'BEGIN {sum=0} {sum+=$1} END {print sum}'`

docs/stubl_thumb.gif

2.72 KB
Loading

0 commit comments

Comments
 (0)