redis生产环境持久化_在SageMaker上安装持久性Julia环境
redis生產環境持久化
SageMaker is a great environment for data scientists to explore new languages and methods without having to worry too much about the underlying infrastructure. As long as you don’t need to customize the existing environments, everything looks great and just works. However, as soon as you want to venture off the beaten path you will run into some unexpected challenges.
SageMaker為數據科學家提供了一個探索新語言和新方法的絕佳環境,而無需過多地擔心基礎架構。 只要您不需要自定義現有的環境,一切看起來就很好并且可以正常工作。 但是,一旦您想走人跡罕至的道路,就會遇到一些意想不到的挑戰。
Our data scientists are generally cost conscious and happily stop their SageMaker instances when they are not using them. Unfortunately, SageMaker doesn’t persist any data written outside of the ~/SageMaker directory. This means that changes to the Anaconda environments don’t persist across restarts of the notebook. This is very frustrating. To fix this we need to create a persistent Anaconda environment in the ~/SageMaker folder and tell Julia to place its packages there as well. Let’s get started!
我們的數據科學家通常精打細算,并且在不使用SageMaker實例時會高興地停止它們。 不幸的是,SageMaker不會保留~/SageMaker目錄之外寫入的任何數據。 這意味著對Anaconda環境的更改不會在筆記本計算機重新啟動后持續存在。 這非常令人沮喪。 為了解決這個問題,我們需要在~/SageMaker文件夾中創建一個持久的Anaconda環境,并告訴Julia也將其軟件包放置在此處。 讓我們開始吧!
Log on to your SageMaker environment and open a new Terminal session. Let’s create a new, empty Anaconda environment, located in the ~/SageMaker directory.
登錄到您的SageMaker環境并打開一個新的終端會話。 讓我們在~/SageMaker目錄中創建一個新的空Anaconda環境。
conda create --yes --prefix ~/SageMaker/envs/juliaDownload and extract the latest version of Julia
下載并提取最新版本的Julia
curl --silent https://julialang-s3.julialang.org/bin/linux/x64/1.5/julia-1.5.0-linux-x86_64.tar.gz | tar xzf -cp -R julia-1.5.0/* ~/SageMaker/envs/julia/
Before we start installing packages for Julia we need to make sure that Julia is loading its packages from the right directory. This also ensures that packages you install via a notebook or from the Terminal will also be stored in the persistent space of the SageMaker instance.
在開始為Julia安裝軟件包之前,我們需要確保Julia從正確的目錄加載其軟件包。 這還可以確保您通過筆記本電腦或從終端安裝的軟件包也將存儲在SageMaker實例的永久空間中。
mkdir -p ~/SageMaker/envs/julia/etc/conda/activate.decho 'export JULIA_DEPOT_PATH=~/SageMaker/envs/julia/depot' >> ~/SageMaker/envs/julia/etc/conda/activate.d/env.shecho -e 'empty!(DEPOT_PATH)\npush!(DEPOT_PATH,raw"/home/ec2-user/SageMaker/envs/julia/depot")' >> ~/SageMaker/envs/julia/etc/julia/startup.jlWe can now activate the environment and start installing our dependencies including IJulia. Launch the Julia REPL, install and activate IJulia.
現在,我們可以激活環境并開始安裝我們的依賴項,包括IJulia。 啟動Julia REPL,安裝并激活IJulia。
juliausing PkgPkg.add("IJulia")
using IJulia
Exit the REPL (Ctrl + D) and open Jupyter or JupyterLabs. The new Julia 1.5.0 Kernel should now be visible and you are all set.
退出REPL(Ctrl + D)并打開Jupyter或JupyterLabs。 現在應該可以看到新的Julia 1.5.0內核,并且一切就緒。
After restarting the SageMaker instance you will notice that the Julia kernel has vanished. To restore the kernel, simply execute
重新啟動SageMaker實例后,您會注意到Julia內核已消失。 要還原內核,只需執行
conda run --prefix ~/SageMaker/envs/julia/ julia --eval 'using IJulia; IJulia.installkernel("Julia")'You can get fancy and register this script as a Notebook Lifecycle Configuration which is executed automatically whenever the SageMaker instance is launched. You can find more details on how to set that up at https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html.
您可以將這個腳本注冊為Notebook Lifecycle Configuration,并在啟動SageMaker實例時自動執行。 您可以在https://docs.aws.amazon.com/sagemaker/latest/dg/notebook-lifecycle-config.html上找到有關如何進行設置的更多詳細信息。
翻譯自: https://towardsdatascience.com/installing-a-persistent-julia-environment-on-sagemaker-c67acdde9d4b
redis生產環境持久化
總結
以上是生活随笔為你收集整理的redis生产环境持久化_在SageMaker上安装持久性Julia环境的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 官人驾到怎么娶媳妇(汉典官人词语的解释)
- 下一篇: 海贼王强者之路怎么实现一人流