Created
February 2, 2020 10:38
-
-
Save cmd-ntrf/f356cf761d3b20a926e2899e0aa46a73 to your computer and use it in GitHub Desktop.
Suspend/resume draft
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "`date` $2 $1" >> /etc/slurm/elastic.log | |
# Parsing slurm array format (ex. `node[1-4]`, `node[1,3-5]`, `node2`) | |
node=$(echo "$1" | grep -Po '[a-zA-Z]+') | |
gcloud auth activate-service-account --key-file=/etc/slurm/credentials.json | |
for i in $(echo "$1" | grep -Po '\d+[-\d+]*') | |
do | |
range=$(echo "$i" | grep -Po '\d+') | |
if [[ `echo $range | wc -w` -eq 1 ]] | |
then | |
range="$range $range" | |
fi | |
for j in $(seq $range) | |
do | |
gcloud compute instances $2 "$node$j" --async --zone=${zone} --quiet >> \ | |
/etc/slurm/elastic.log | |
done | |
done |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/etc/slurm/elastic.sh $1 start |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Add the following to slurm.conf | |
# Elastic Computing | |
SuspendProgram=/etc/slurm/suspend.sh | |
ResumeProgram=/etc/slurm/resume.sh | |
SuspendTime=90 | |
SuspendExcNodes=node[1-127] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/etc/slurm/elastic.sh $1 stop |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment