Last active
October 1, 2021 10:46
-
-
Save fauberso/b4f7e632dd32262ce604c28fc67ec591 to your computer and use it in GitHub Desktop.
SageMaker: Auto Stop instance, and add Conda packages from conda-forge
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 | |
set -e | |
# PARAMETERS | |
IDLE_TIME=7200 | |
echo "Fetching the autostop script" | |
wget https://raw.githubusercontent.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples/master/scripts/auto-stop-idle/autostop.py | |
echo "Starting the SageMaker autostop script in cron" | |
(crontab -l 2>/dev/null; echo "*/5 * * * * /usr/bin/python $PWD/autostop.py --time $IDLE_TIME --ignore-connections") | crontab - | |
echo "Installing Dependencies" | |
export PATH="/home/ec2-user/anaconda3/condabin:$PATH" | |
conda config --add channels conda-forge | |
conda config --set channel_priority strict | |
conda install --yes numpy-indexed smart_open & |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment