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.

feita há um mês106 visualizações
5 Respostas
0
Resposta aceita

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
respondido há 21 dias
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.

respondido há 22 dias
  • 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.

respondido há 20 dias
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
respondido há 22 dias
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
respondido há 17 dias

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas