List currently active kernels in jupyter session
- Dominant language
- Jupyter Notebook
- Stars
- 13.3k
- Forks
- 5.8k
- Avg merge
- 6d 11h
- Merged PRs (30d)
- 7
Description
I've Google'd quite a bit to find a solution for the following use-case.
Essentially, my root problem is that I try to find a way to automatically persist an interactive ipython session such that I can restore its state in case a) any client gets disconnected or the jupyter server is stopped, or b) to connect from a different front-end in a different client (might be from completely different device connecting through ssh/mosh, like my iPhone/iPad).
I have also looked into alternatives, such as `dill`, however they require manual saving of the state. Hence, I think having a running ipython kernel on my remote cloud machine is the way to go. So, then, I would need a way to connect multiple front-ends to the same ipython kernel.
These front-ends might be:
- jupyter console
- VSCode interactive
- Jupyter Lab
- Jupyter Notebook
I currently keep a Jupyter server running on my cloud machine, I then connect to the machine using VSCode interactive python (using their new built in way of connecting to Jupyter), which will automatically start a new kernel (I cannot seem to connect to an existing one so this front-end appears to have to be the first to connect).
Jupyter will then log the new kernel id to the terminal, which I can then append to
```bash
jupyter console/notebook --existing kernel-.json
```
There is multiple issues here, however.
1) VSCode will disconnect as soon as connectivity is lost and cannot reconnect to the kernel, hence, in 99% of the cases I cannot use `%connect_info`
2) Jupyter notebook logs a lot of info to the terminal, scrolling up in tmux after having the server running for more than 2mins becomes an ordeal
So my questions:
a) Is there a smarter, built-in way to solve my root problem?
b) If not, how do I get a list of running active kernels from a jupyter server so I can connect to them?
Thanks a lot!
Contributor guide
Research direction
The issue names no repository files or tests. Start by reviewing the Jupyter server/kernel connection entry points described here, including jupyter console --existing and %connect_info. Done would mean a documented or supported way to discover active kernels and reconnect front ends after disconnection.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- jupyter-notebook, python, vscode
- Domain
- api, backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100