-
Notifications
You must be signed in to change notification settings - Fork 305
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
Inconsistency in the KernelManager.get_kernel API implementations #455
Inconsistency in the KernelManager.get_kernel API implementations #455
Comments
We can make |
Thanks @davidbrochart, I think that would help with the consistency issue! |
I agree there's an inconsistency here - especially with the In the case of the If we really needed to, we could fabricate a To be honest, GKM was never intended to be used outside of the handlers. If we really (really) see the need to bring this in line with how normal KMs are used today, then I think we'd be looking at using the likes of the HTTPKernel{Manager,Client} classes within the gateway package - which has yet to show a need for that. |
@kevin-bates if we were to extract the The classes in Elyra look good to me. |
A few questions/comments:
|
Thanks for the questions @ellisonbg.
The It's unfortunate that the I'm hoping we can bring the GKM more in line with the MKM interfaces, which I think makes sense, but then would require a
Yes, an adapter pattern could be something to use as a contingency should b/c support become a concern but hopefully unnecessary. @declanvk - I had been writing a response to your comment when Brian's came in, but feel I still owe that to you. I think it's "in tune" with my response above, but may require we wait for the dust to settle.
I think we'd place these into the gateway package and need to refactor the existing
No. Elyra already has a dependency on jupyter_server and all that we need to do is move the HKM - which Elyra can then make accessible to Papermill/nbclient.
Yes - although the "manager" work would move to the Also, note that If this is something you'd still like to pursue, perhaps I could get a branch going and we could work out any kinks there - keeping in mind the end goal is a general-purpose kernel management alternative that essentially routes to a Gateway server. |
I've created a branch in my fork (https://github.com/kevin-bates/jupyter_server/tree/refactor-gateway-km) that uses I tried running Voila but could not (quickly) figure out how to make it run using Jupyter server or add options like Also, note that I couldn't get the kernel client stuff to go through the handlers (this pick was busted back when it was originally implemented in Elyra) and so a dependency on |
I'll try to take a look at this sometime this week, thank you for starting this branch. |
Hi @declanvk. I'd like to submit a PR for this given the refactoring doesn't affect the current behavior and I've confirmed that the Elyra server extension can successfully use the refactoring in place of the aforementioned I think with these changes basic "nbclient" functionality can take place (e.g., like that performed by papermill). Where I suspect things could get dicey is if the server extension were to use KernelManager ports directly or make locality assumptions. I believe we can cross that bridge at that time rather than try to cover all scenarios before initial exposure. I suspect this might make your investigations easier as well. |
I wasn't sure where the best place for this was, given that this issue touches on
jupyter_client
,jupyter_server
, andvoila
.jupyter_server
seemed best as a middle point.Description
There is an inconsistency between different implementations of the
KernelManager
interface, specifically in the output of theget_kernel
method.In the
GatewayKernelManager
implementation, theget_kernel
method returns a dictionary that is parsed from the response from the remote gateway:jupyter_server/jupyter_server/gateway/managers.py
Lines 412 to 440 in 74801f4
In the
MultiKernelManager
implementation, theget_kernel
method returns an object from a lookup table that it maintains:https://github.com/jupyter/jupyter_client/blob/master/jupyter_client/multikernelmanager.py#L321-L330
The object in that lookup table is created as part of the
pre_start_kernel
method, from a specified factory:https://github.com/jupyter/jupyter_client/blob/50dff2e809cf7b67128e7e2f0cb422e751011ef9/jupyter_client/multikernelmanager.py#L156-L175
Expected Behavior
I was interested in supporting Voila with a custom KernelManager implementation that is very similar to the
GatewayKernelManager
, but ran into this issue when Voila was attempting to use the value returned byget_kernel
in ways that I had not accounted for. Specifically, the code that it was trying to run:https://github.com/voila-dashboards/voila/blob/ae3d025dda21f72c2a663d04cf4ff10dc9215f08/voila/handler.py#L177-L181
where it is using methods that are not present on a simple dictionary.
Depending on how the maintainers feel about this, either the GatewayKernelManager should have some changes to bring it in line with the other
KernelManager
implementations, or I could ask thevoila
maintainers if they would accept a solution that detects the return type and then use different implementations for thedict
vs object result.The text was updated successfully, but these errors were encountered: