Skip to content

Commit cadfc5a

Browse files
committed
Updated cluster slots detection for Slurm from Galaxy
1 parent d262323 commit cadfc5a

1 file changed

Lines changed: 14 additions & 5 deletions

File tree

pulsar/managers/util/job_script/CLUSTER_SLOTS_STATEMENT.sh

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
export GALAXY_SLOTS_CONFIGURED="1"
2-
if [ -n "$SLURM_NTASKS" ]; then
3-
# May want to multiply this by ${SLURM_CPUS_PER_TASK:-1}.
4-
# SLURM_NTASKS is total tasks over all nodes so this is
5-
# shouldn't be used for multi-node requests.
6-
GALAXY_SLOTS="$SLURM_NTASKS"
2+
if [ -n "$SLURM_CPUS_ON_NODE" ]; then
3+
# This should be valid on SLURM except in the case that srun is used to
4+
# submit additional job steps under an existing allocation, which we do not
5+
# currently do.
6+
GALAXY_SLOTS="$SLURM_CPUS_ON_NODE"
7+
elif [ -n "$SLURM_NTASKS" ] || [ -n "$SLURM_CPUS_PER_TASK" ]; then
8+
# $SLURM_CPUS_ON_NODE should be set correctly on SLURM (even on old
9+
# installations), but keep the $SLURM_NTASKS logic as a backup since this
10+
# was the previous method under SLURM.
11+
#
12+
# Multiply these values since SLURM_NTASKS is total tasks over all nodes.
13+
# GALAXY_SLOTS maps to CPUS on a single node and shouldn't be used for
14+
# multi-node requests.
15+
GALAXY_SLOTS=`expr "${SLURM_NTASKS:-1}" \* "${SLURM_CPUS_PER_TASK:-1}"`
716
elif [ -n "$NSLOTS" ]; then
817
GALAXY_SLOTS="$NSLOTS"
918
elif [ -n "$PBS_NCPUS" ]; then

0 commit comments

Comments
 (0)