![](/img/trans.png)
[英]ValueError: Must setup local AWS configuration with a region supported by SageMaker
[英]AWS Sagemaker Life Cycle Configuration - AutoStop
我在我的 AWS sagemaker NOTEBOOKS 选项卡中创建了 4 个实例。
我想创建一个生命周期配置,其中实例应在每天晚上 9:00 停止。
我看过一些例子,但它与 IDLE TIME 有关,但与特定时间无关
#!/bin/bash
set -e
# PARAMETERS
IDLE_TIME=3600
echo "Fetching the autostop script"
wget -O autostop.py https://raw.githubusercontent.com/mariokostelac/sagemaker-setup/master/scripts/auto-stop-idle/autostop.py
echo "Starting the SageMaker autostop script in cron"
(crontab -l 2>/dev/null; echo "*/5 * * * * /bin/bash -c '/usr/bin/python3 $DIR/autostop.py --time ${IDLE_TIME} | tee -a /home/ec2-user/SageMaker/auto-stop-idle.log'") | crontab -
echo "Changing cloudwatch configuration"
curl https://raw.githubusercontent.com/mariokostelac/sagemaker-setup/master/scripts/publish-logs-to-cloudwatch/on-start.sh | sudo bash -s auto-stop-idle /home/ec2-user/SageMaker/auto-stop-idle.log
谁能帮我解决这个问题?
将 crontab 语法更改为0 21 * * * shutdown.py
然后创建一个 shutdown.py ,它是autostop.py的缩减版本,主要包含:
...
print('Closing notebook')
client = boto3.client('sagemaker')
client.stop_notebook_instance(NotebookInstanceName=get_notebook_name())
顺便说一句: shutdown now
对我不起作用,因此改为调用 SageMaker API。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.