-
-
Notifications
You must be signed in to change notification settings - Fork 397
Description
Hello,
I’d created a similar discussion in Jupyter Google Groups but looks that responsible people from IPython kernel does not participate in groups.
Brief explanation: I tried to implement a tunnel for the pydev debugger through notebook’s websocket and using Comm. Unfortunately, Comm and cell execution shares the same thread, so when debugger suspends the cell’s code it also suspends the tunnel. Anyway, I'd succeeded to implement it by moving a Control channel in a separate thread using monkey-patching but it doesn't look like a production-ready solution.
I propose to move handling of the Control channel in a separate thread and add an analog of Comm for that thread. It could be used for tunneling streams of a debugger or for collecting metrics at runtime.
A rough algorithm of handling each message in a separate thread:
- If the message can be handled in the Control thread then handle it immediately. Example of methods that can be handled here:
kernel_info_request,complete_request, Comm for Control. - Otherwise the message is being re-queued into main thread’s event loop and then it being handled like in a current implementation.
Do you see any obvious pitfalls around handling the Control channel in a separate thread? If I’ll prepare a patch with acceptable code quality, will you merge it?