[slurm-users] Getting nodes in a partition

Mahmood Naderan mahmood.nt at gmail.com
Fri May 18 02:53:26 MDT 2018


>slurm comes with hostlist extraction:
>
>[mahmood at rocks7 ~]$ scontrol show hostnames $(scontrol show partition MYPART | grep -w Nodes | cut -d '=' -f 2)


Excellent. That works. Many thanks...


I wrote the following method before that!

[mahmood at rocks7 ~]$ cat nodes.sh
#!/bin/bash
NAMES=`scontrol show partition NOLIMIT | grep -w Nodes | cut -d '=' -f 2`
echo $NAMES
BASENAME=`echo $NAMES | cut -d '[' -f 1`
RANGE=`echo $NAMES | cut -d '[' -f2 | cut -d ']' -f1`
START=`echo $RANGE | cut -d '-' -f1`
END=`echo $RANGE | cut -d '-' -f2`
for (( i=$START; i <= $END; i++ )); do
  echo "$BASENAME$i"
done
[mahmood at rocks7 ~]$ ./nodes.sh
compute-0-[4-6]
compute-0-4
compute-0-5
compute-0-6




Regards,
Mahmood



More information about the slurm-users mailing list