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.

posta un mese fa113 visualizzazioni
5 Risposte
0
Risposta accettata

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
con risposta un mese fa
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.

con risposta un mese fa
  • 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.

con risposta un mese fa
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
con risposta un mese fa
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
con risposta 24 giorni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.

Linee guida per rispondere alle domande