Sticky AWS Glue Notebook Sessions

1

I work a lot using AWS Glue Notebooks and I cannot find a way to restart sessions seamlessly. The use case is the following:

  • I start a notebook
  • After a while I need to change some config in the current session
  • I restart the kernel
  • The session goes in stopped state
  • The %status magic returns: "There is no current session"
  • When I attempt to recreate a session I get the following exception:
An error occurred (AlreadyExistsException) when calling the CreateSession operation: Session already created, sessionId=2167b01d-43a3-49e1-a2ee-c804e6940e83

The only workaround I found is to delete the session from the console manually. Not the best in my opinion. Is there a best way already available?

profile picture
asked 8 months ago668 views
2 Answers
1

I have discovered that using the %stop_session magic works. The current session goes in the stopped state and is detached from the kernel. I would suggest to add a macro/widget to the notebook command bar.

profile picture
answered 8 months ago
  • Ideally it should just detect the kernel restart and do the stop and cleanup automatically, will open a request to see if that's possible

  • Had the same issue and "%stop_session" magic did the trick. Yes, doing this automatically upon kernel restart would be even better.

0

Getting the same issue

Enter image description here

Tony
answered 3 months ago
  • The session is probably stopping but it has not stopped yet. When this happens to me I normally look for the session in the interactive session list and I check the state. Then I wait or a kill it manually.

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