Skip to content

Commit 919063d

Browse files
author
Michael Jennings
committed
Merge pull request #16 from bbbbbrie/dev
This fixes #15 by using squeue instead of stat to obtain the list of authorized users
2 parents c02d299 + 43f18ec commit 919063d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

scripts/lbnl_job.nhc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ NHC_AUTH_USERS="${NHC_AUTH_USERS:-root nobody}"
99

1010
# Find all users with jobs currently running on the node.
1111
function nhc_job_find_users() {
12-
local IFS JOBFILE JOBUSER STAT_OUT LINE PBS_XML
12+
local IFS JOBFILE JOBUSER SQUEUE_OUT LINE PBS_XML
1313
local -a JOBLIST USERLIST
1414

1515
dbg "Searching for job files"
@@ -54,9 +54,9 @@ function nhc_job_find_users() {
5454
elif [[ "$NHC_RM" == "slurm" ]]; then
5555
SLURM_SERVER_HOME="${SLURM_SERVER_HOME:-/var/spool/slurmd}"
5656
JOBFILE_PATH="${JOBFILE_PATH:-$SLURM_SERVER_HOME}"
57-
STAT_OUT=$(${STAT_CMD:-/usr/bin/stat} ${STAT_FMT_ARGS:--c} %U $JOBFILE_PATH/job*/slurm_script)
57+
SQUEUE_OUT=$(${SQUEUE_CMD:-/usr/bin/squeue} ${SQUEUE_NODE:--w $(hostname -s)} ${SQUEUE_FMT_ARGS:---noheader -o %u})
5858
IFS=$'\n'
59-
USERLIST=( $STAT_OUT )
59+
USERLIST=( $SQUEUE_OUT )
6060
IFS=$' \t\n'
6161
dbg "Found ${#USERLIST[*]} job files in $JOBFILE_PATH"
6262
for JOBUSER in "${USERLIST[@]}" ; do

0 commit comments

Comments
 (0)