SageMaker Studio - Code Editor - Refresh Connection without losing changes

0

How can we prevent SageMaker Studio's code editor from losing connection when the browser disconnects (for example when a user locks its screen).

I have found that while hitting F5 / refreshing the browser tab seems to reset the connection and make the IDE responsive again it also resets kernels and loses unsaved changes.

已提问 1 个月前113 查看次数
5 回答
0
已接受的回答

You can reconnect to the previous Jupyter session by following steps:

  1. Start "jupyter notebook" in the Terminal
  2. Copy the URL to your clipboard (e.g. http://localhost:8889/tree?token=1234abcd....)
  3. Open the notebook
  4. Choose "Select Kernel" > "Select Another Kernel ..." > "Existing Jupyter Server ..." > "Enter the URL of the running Juputer Server..." > "Python3 (ipykernel)"
  5. Paste the URL you copied at step 2
  6. Reload your browser, the notebook opens but kernel is not selected yet
  7. Choose "Select Kernel" > "Select Another Kernel ..." > "Existing Jupyter Server ..." > "Enter the URL of the running Juputer Server..."
  8. Choose existing Jupyter Session, instead of Jupyter Kernel.
  9. Confirm that you can resume running your notebook.

With default kernels (e.g. "Python 3.10.14"), you cannot reconnect to the previous session after reloading/closing notebooks.

AWS
已回答 1 个月前
0

Thanks, Tomonori for your support.

To be more specific. This problems happens while using jupyter notebooks.

What I do:

  1. Open new jupyter notebook

  2. Start Python kernel and execute some cells. initialization

  3. Refresh the browser.

  4. Try to retake my kernel but it is lost retry-after-refresh

In EMR Studio there is a button to reconnect to kernel. Maybe this could work in SageMaker Studio as well.

已回答 1 个月前
  • Thank you for clarifying the issue. I will add another answer.

0

Thanks again Tomonori.

I've tried this workaround and it works.

It would be great if you could make it work with default kernels as well. I think this workaround could be somewhat difficult/tedious to non-technical users.

已回答 1 个月前
0

To avoid losing your files by reloading browser, you can use "Auto Save" setting.


Enter image description here

About losing connection, I was not able to reproduce the issue. What I tested:

  1. Open Code Editor on my browser.
  2. Open new terminal
  3. Run "watch date" command, to keep printing date and time.
  4. Close the browser tab
  5. Reopen the Code Editor from SageMaker Studio screen
  6. Open new terminal
  7. Confirm "watch" terminal exists already, and it is still keeping printing date and time.

Please let us know if you are seeing different behavior when you follow the above steps.

AWS
已回答 1 个月前
0

Folks, this is related to a feature request that the VS Code Jupyter extension team is currently tracking in this issue. Please make sure you vote on it to get it prioritized.

profile pictureAWS
Eric
已回答 24 天前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则