kernel_gateway
kernel_gateway copied to clipboard
async endpoints in a single notebook using notebook-http method
Hi, I didn't find any method to auto spawn kernels or to process multiple requests at a time asynchronously. I am finding the requests being processed parallelly is equal to the number of prespawn notebooks specified, else they are processed serialized.
Hi @shreyashk09. Your observations are what I'd expect right now. Both kernel startup and communication are synchronous...until recently.
jupyter_client (on which notebook sits on which kernel gateway sits) recently added support for both async kernel client and manager. Also, notebook will support async kernel management in its next release after https://github.com/jupyter/notebook/pull/4479 was merged.
To take advantage of this, Kernel Gateway will require two slight changes in kernel_gateway/services/kernels/manager.py
to change their classes to derive from the Async forms of MappingKernelManager
and IOLoopKernelManager
. While both jupyter_client and notebook retain their synchronous classes as well, I don't think KernelGateway would need to do the same and could just switch to the Async forms.
If you'd like to make that change and see if it resolves this issue that would be much appreciated. I've already made a similar change in this Enterprise Gateway PR - just waiting for the Notebook release.
If you have any questions, I'd be happy to assist.