-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
IPEP 12: add KernelClient #3011
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Great, I will try to have a look at this soon. |
I think I will not reorganize the channels to not be threads in this PR - it seems a bit out of scope. |
Looks like I'm almost there. The only thing remaining is to finish up the autorestart work started in the parent PR. I am not confident in the in-process kernel - the test coverage is minimal, and there are zero use cases within IPython. I really don't like that we have something this complicated that is totally unused and almost totally untested. |
I think this is ready for review |
I would like to help here because I think this could simplify things a lot for us. How can I do it? |
Mainly this just needs review, I think it's complete now. |
I meant help with testing :) Is there something expected to work differently with the new API? Some corner case that needs a little bit of extra help to test? If not, then just ignore me :) |
Gotcha, thanks. Most things work the same, with these changes:
|
@@ -0,0 +1,127 @@ | |||
"""Abstract base classes for kernel client channels""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably name this channelsabc.py
for consistency with other foo/fooabc naming convention.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
required adding **kwarg passthrough in InteractiveShell parents
makes it harder to mistake a quick restart from real failure
generally not necessary, but sometimes the kernel connection can be dirty. We have only seen this by starting a qtconsole via %qtconsole, then killing the kernel, at which point the original notebook's connection (at the zmq level) is never restored to the new kernel at the same endpoint. It's weird, and probably a zmq bug, but a simple reconnect seems to solve it.
avoids lingering connections to zmq sockets across kernel restart
it wasn't actually necessary (proper fix in previous commit)
So that the qtconsole can notice that a kernel has restarted uncleanly
Testing restarts in qtconsole (no notebook): I ran the qtconsole and tried killing the kernels using:
I did this repeatedly and in different tabs. I observed the following tracebacks:
I am trying to find reproducible steps to help debug this. |
I am having trouble finding a good way to reproduce these errors, but the second one is a clear bug in the code. The |
Great work, merging! |
IPEP 12: add KernelClient
This is the big first step in IPEP 12: splitting the two roles of KernelManager into two objects - exactly one KernelManager, which starts/stops/restarts kernels, and zero-to-many KernelClients, which perform actions via channels.
I have not enabled autorestart in the plain terminal console, I am not sure that I should, since there is no background eventloop, unlike the qtconsole and notebook.
IPEP12-related changes that are not part of this PR:
ipython kernel
entrypoint should operate via a KernelManageripengine
should use KernelManagers