explorer
explorer

Reputation: 61

Jupyter notebook kernel disconnecting / dead after sometime and cannot reconnect to amazon EC2 instance and complete ( currently running) operation.

  1. When I connect to EC2 instance via Mobaxterm, after some period of time my jupyter notebook's kernel loses connection.
  2. And some highly time-consuming operations /(Currently running tasks) are required to be re-performed again and again and are never-ending (This repeats each and every time).
  3. I'm closing the notebook and restarting, so I can gain a connection to the kernel because it doesn't reconnect and I had to go through the process again and again when it dies eventually.
  4. It also shows SSL error, wrong version number sometimes before disconnecting.

Upvotes: 5

Views: 3394

Answers (2)

Dwa
Dwa

Reputation: 673

Just use nohup. This should be the builtin tool in all Linux machines.

So you should do: nohup jupyter notebook > output.txt

And then you can safely terminate the console session without worrying about killing the notebook.

Upvotes: 1

Amit Hasan
Amit Hasan

Reputation: 11

I have also faced a similar problem. I solved it with the help of 'tmux'. I followed these steps:

  1. I installed 'tmux' in my machine in the AWS instance.

[Actually, it came preinstalled with the AMI I had been using on the EC2 instance.]

  1. I created a 'tmux' session simply by entering the command: tmux
  2. Then I ran necessary commands to run the Jupyter server or Jupyter notebook
  3. To close the terminal, I used this command: (i) ctrl + b, (ii) d

[Please notice, the session will continue running on the EC2 instance until you close the instance or close the jupyter server or the jupyter notebook].

  1. To connect to the session again, I used the command: tmux attach
  2. To finally kill the 'tmux' session when I am done, I used the command: tmux kill-session

Upvotes: 1

Related Questions