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.

asked 14 days ago90 views
5 Answers
0
Accepted Answer

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
answered 8 days ago
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.

answered 9 days ago
  • 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.

answered 7 days ago
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
answered 9 days ago
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
answered 4 days ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions