Sagemaker Code Editor - Run Python script while computer is off

0

Hello,

I am trying to train a model using a Python script inside of the Sagemaker Code Editor. The script is started from the terminal. When I shut the computer down, the script continues to run for a couple of minutes longer, than hangs itsself. When I log back in the Code Editor, the script continues to run from the point it stopped. How can I run python scripts in the background, so that I do not have to keep the computer on and still see the output in the terminal?`

Thanks!

RaduM
질문됨 한 달 전125회 조회
2개 답변
1

ℹ️ You can execute a Python script in the background using the nohup command, which ensures that the process continues to run even after you exit the shell or terminal. However, it's important to note that nohup does not keep the script running if the computer on which it is executed is turned off or shut down. For more details on using the nohup command, you can refer to this guide: Nohup Command in Linux.

Example:

nohup python your_script.py > output.log &
profile picture
전문가
답변함 한 달 전
0

Hello,

Please note that when we shut down, the terminal will not be able to record any output information. To continue to run the script and get the complete output even after you turn off your device, you can use "nohup" command.

nohup python script.py > output.log &

Please refer to https://paulorod7.com/running-a-python-script-in-terminal-without-losing-it-by-a-connection-drop for more details.

AWS
지원 엔지니어
답변함 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠