>slurm comes with hostlist extraction:
>
>[mahmood@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@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@rocks7 ~]$ ./nodes.sh
compute-0-[4-6]
compute-0-4
compute-0-5
compute-0-6




Regards,
Mahmood

Reply via email to