Skip to content

Commit fd1c774

Browse files
committed
Fixed SCREEN detect problem in fisbatch. Added support for all users to slogs. Added slimits command.
1 parent fab469b commit fd1c774

File tree

3 files changed

+35
-3
lines changed

3 files changed

+35
-3
lines changed

bin/fisbatch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ usr=`whoami`
156156
NODE=`squeue -h --clusters=${cluster} --partition=${partition} --jobs=${JOB} -o %N | grep -v "^CLUSTER"`
157157
NODE=`nodeset -e $NODE`
158158
for i in $NODE; do
159-
screenTest=`ssh $i "ps -ef | grep $usr | grep [S]CREEN | wc -l"`
159+
screenTest=`ssh $i "ps -ef | grep $usr | grep \[S\]CREEN | wc -l"`
160160
if [ "$screenTest" != "0" ]; then
161161
HNODE=$i
162162
break

bin/slimits

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
if [ "$1" == "--help" ]; then
4+
echo "======================================================="
5+
echo ""
6+
echo " slimits - a script that retrieves job submission "
7+
echo " limits for a given user. "
8+
echo ""
9+
echo " Usage: slimits [user_id] "
10+
echo " Defaults to user running the command if no id given."
11+
echo "======================================================="
12+
13+
exit
14+
fi
15+
16+
if [ "$1" == "" ]; then
17+
TheUser=`whoami`
18+
else
19+
TheUser=$1
20+
fi
21+
22+
sacctmgr show associations user=$TheUser

bin/slogs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if [ "$1" == "--help" ]; then
5252
echo " start_date : 010113 if no start date is given. "
5353
echo ""
5454
echo " users : Current user if no user name is given. "
55-
echo ""
55+
echo " \"all\" selects all users "
5656
echo "======================================================="
5757

5858
exit
@@ -81,6 +81,15 @@ else
8181
TheGroup=$dol2
8282
shift
8383
fi
84+
85+
if [ "$TheGroup" == "all" ]; then
86+
TheGroup=`sacct --start=${StartDate} --allusers $@ -ouser -n | \
87+
sort -u | \
88+
sed 's/ //g' | \
89+
tr '\n' ',' | \
90+
sed 's/^,//g' | \
91+
sed 's/,$//g'`
92+
fi
8493
TheList=`echo "$TheGroup" | tr ',' ' '`
8594

8695
EndDate=`date +%m%d%y`
@@ -91,13 +100,14 @@ TMPFILE=${TheGroup}_usage_logs_${StartDate}_to_${EndDate}.tmp
91100
OUTFILE=${TheGroup}_usage_logs_${StartDate}_to_${EndDate}.txt
92101

93102
echo "JobID User NCPUS Start Date Time Elapsed ReqMem AveRSS MaxRSS" > $TMPFILE
103+
94104
for i in $TheList; do
95105
echo "Retrieving accouning data for user $i ..."
96106
sacct --start=${StartDate} --user=$i $@ | \
97107
sed "s/$i//g" |
98108
sed "s/T/ /g" | \
99109
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);
110+
printf("%-20s %-8s %5s %10s %8s %10s %8s %9s %9s\n", $1, user, $2, $3, $4, $5, $6, $7, $8);
101111
}' \
102112
>> $TMPFILE
103113
done

0 commit comments

Comments
 (0)