【问题标题】:Lifetime cycle config is longer than 5 minutes, nohup command not working生命周期配置超过 5 分钟,nohup 命令不起作用
【发布时间】:2022-01-12 11:13:37
【问题描述】:

我正在尝试为我的 jupyter 笔记本安装一些依赖项,但希望它们是永久性的,以便在我每次重新启动笔记本时节省 20 分钟。我选择使用生命周期配置,但是,我的脚本运行时间超过 5 分钟。我找到这篇文章 (https://aws.amazon.com/premiumsupport/knowledge-center/sagemaker-lifecycle-script-timeout/) 来帮助解决这个问题,但是,我的笔记本仍然无法启动,并出现以下错误:

Notebook Instance Lifecycle Config 'arn:aws:sagemaker:eu-west-2:347285168835:notebook-instance-lifecycle-config/nbs-aap-dev-dsar' for Notebook Instance 'arn:aws:sagemaker:eu-west-2:347285168835:notebook-instance/nbs-aap-dev-dsar' took longer than 5 minutes. Please check your CloudWatch logs for more details if your Notebook Instance has Internet access.

这是我要运行的脚本:

sudo nohup yum install wget &
sudo yum install autoconf &
sudo yum install automake &
sudo yum install libtool &
sudo yum install jpeg &
sudo yum install tiff &
sudo yum install libpng &
sudo yum install tiff2png &
sudo yum install libtiff &
sudo yum install autoconf aclocal automake &
sudo yum install libtool &
sudo yum -y install libjpeg-devel libpng-devel libpng-devel libtiff-devel zlib-devel &
sudo yum install gcc gcc-c++ make &
sudo wget https://github.com/DanBloomberg/leptonica/releases/download/1.82.0/leptonica-1.82.0.tar.gz &
sudo tar xzvf leptonica-1.82.0.tar.gz &
cd leptonica-1.82.0 &
sudo ./configure --prefix=/usr/local/ &
sudo make &
sudo make install &
sudo wget https://codeload.github.com/tesseract-ocr/tesseract/tar.gz/4.1.1 &
sudo tar -zxvf 4.1.1 &
cd tesseract-4.1.1 &
sudo ./autogen.sh &
sudo cp /home/ec2-user/leptonica-1.82.0/lept.pc /usr/lib64/pkgconfig/. &
sudo LIBLEPT_HEADERSDIR=/usr/local/lib ./configure --prefix=/usr/local/ --with-extra-libraries=/usr/local/lib &
sudo make &
sudo make install &
export LD_LIBRARY_PATH=/usr/local/lib &
sudo ldconfig &
sudo wget https://github.com/tesseract-ocr/tessdata_best/raw/main/eng.traineddata &
sudo mv -v eng.traineddata /usr/local/share/tessdata/eng.traineddata &
sudo wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9550/ghostpdl-9.55.0.tar.gz &
sudo tar -zxvf ghostpdl-9.55.0.tar.gz &
cd ghostpdl-9.55.0 &
sudo ./configure --prefix=/usr/local/ &
sudo make &
sudo make install &
sudo yum -y install poppler-utils &
sudo wget https://github.com/qpdf/qpdf/releases/download/release-qpdf-10.1.0/qpdf-10.1.0.tar.gz &
sudo tar xzvf qpdf-10.1.0.tar.gz &
cd qpdf-10.1.0 &
sudo ./configure --prefix=/usr/local/ &
sudo make &
sudo make install

【问题讨论】:

    标签: amazon-web-services jupyter-notebook amazon-sagemaker yum


    【解决方案1】:

    您不需要在行尾添加与符号&。这将它们置于后台并并行执行一些导致奇怪情况的命令。例如在代码中:

    sudo ./configure --prefix=/usr/local/ &
    sudo make &
    sudo make install &
    

    命令makeconfigure 结束之前开始,并且在大多数情况下不会很好地结束。 make install 相同,它会在从 make 编译之前尝试安装已编译的包 如果你想把脚本放在后台,你可以这样对命令进行分组:

    sudo nohup yum -y install wget autoconf automake libtool jpeg tiff libpng tiff2png libtiff autoconf aclocal automake libtool libjpeg-devel libpng-devel libpng-devel libtiff-devel zlib-devel gcc gcc-c++ make poppler-utils 
    
    nohup sudo wget https://github.com/DanBloomberg/leptonica/releases/download/1.82.0/leptonica-1.82.0.tar.gz && sudo tar xzvf leptonica-1.82.0.tar.gz &&cd leptonica-1.82.0 && sudo ./configure --prefix=/usr/local/ && sudo make && sudo make install &
    
    nohup sudo wget https://codeload.github.com/tesseract-ocr/tesseract/tar.gz/4.1.1 &&sudo tar -zxvf 4.1.1 && cd tesseract-4.1.1 && sudo ./autogen.sh && sudo cp /home/ec2-user/leptonica-1.82.0/lept.pc /usr/lib64/pkgconfig/. && sudo LIBLEPT_HEADERSDIR=/usr/local/lib ./configure --prefix=/usr/local/ --with-extra-libraries=/usr/local/lib && sudo make && sudo make install &
    
    nohup export LD_LIBRARY_PATH=/usr/local/lib && sudo ldconfig && sudo wget https://github.com/tesseract-ocr/tessdata_best/raw/main/eng.traineddata && sudo mv -v eng.traineddata /usr/local/share/tessdata/eng.traineddata && sudo wget https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs9550/ghostpdl-9.55.0.tar.gz && sudo tar -zxvf ghostpdl-9.55.0.tar.gz && cd ghostpdl-9.55.0 && sudo ./configure --prefix=/usr/local/ && sudo make && sudo make install &
    
    nohup sudo wget https://github.com/qpdf/qpdf/releases/download/release-qpdf-10.1.0/qpdf-10.1.0.tar.gz && sudo tar xzvf qpdf-10.1.0.tar.gz && cd qpdf-10.1.0 && sudo ./configure --prefix=/usr/local/ && sudo make && sudo make install &
    

    【讨论】:

    • 所以我已将其更改为:sudo su nohup yum install wget nohup yum install autoconf nohup yum install automake nohup yum install libtool nohup yum install jpeg nohup yum install tiff nohup yum install libpng nohup yum install tiff2png nohup yum install libtiff 等。但它似乎仍然无法正常工作。
    • 我需要在后台运行命令,因为我可以在生命周期配置上运行的脚本有 5 分钟的限制。
    • 您也不需要nohup,因为此实用程序可以从终端取消附加。最好将所有要安装的包添加到一行:sudo yum install wget autoconf automake libtool jpeg tiff libpng tiff2png libtiff autoconf aclocal automake libtool
    • 这将超过 5 分钟的时间限制
    • 我正在使用 nohup,这样即使时间限制失败,它也会在后台继续运行
    猜你喜欢
    • 2020-06-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-04-01
    • 1970-01-01
    • 2017-06-07
    相关资源
    最近更新 更多