-
Notifications
You must be signed in to change notification settings - Fork 310
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
Prefix kernel ids #235
Comments
hi @jtpio. The format of a kernel_id should be opaque. Since they have always been a UUID (at least in my understanding), it might be difficult to determine if that's actually the case, but a prefix of the sort you're describing should be okay. The jupyter_server behavior is (currently) directly tied to the notebook server's behavior and I suspect the specification of a kernel_id in this manner is solely to support the ability for multiple notebooks to use the same kernel. Why something like "attach" or "share" wasn't implemented to accomplish this, I don't know. Enterprise Gateway also has a requirement to bring your own kernel_id but accomplishes this via the fact that its callers, in this case, are REST clients and uses the JSON body to convey the custom kernel_id and EG implements Since juptyer_server has My bigger concern is the unknown relative to format, but I suspect that should be okay since UUIDs are rarely interpreted (nor should be). |
Thanks @kevin-bates for the quick reply! The main motivation for now would be to differentiate between the kernels started from a notebook frontend using the default handler from the notebook / jupyter server, and the ones started in a separate handler (but sharing the same kernel manager) with a direct call to Prefixing kernel ids could help, but there might be a better way to achieve this though. |
Hmm - are you expecting things like /api/kernels (to get a list of running kernels) to return different results depending on which handler serviced that request? Or a DELETE /api/kernels/<kernel_id> issued from the notebook front-end to NOT shutdown that kernel if <kernel_id> was a Voila-started kernel? |
Indeed. The prefix would be reflected in the [
{
"id": "10f619b3-5d39-49a6-bed2-5218a32ce774",
"name": "python3",
"last_activity": "2020-05-28T13:18:14.175879Z",
"execution_state": "idle",
"connections": 0
},
{
"id": "8277b7b0-eb11-48c3-bb24-194b902be82e",
"name": "python3",
"last_activity": "2020-05-28T13:18:56.735656Z",
"execution_state": "idle",
"connections": 0
},
{
"id": "voila-be15ce22-d8ff-4d53-ba6b-2aa77925870f",
"name": "python3",
"last_activity": "2020-05-28T13:18:59.548913Z",
"execution_state": "idle",
"connections": 0
}
] |
Could you please clarify? By "Indeed" are you suggesting that, yes, you do want to have the respective handlers filter on their respective "id types"? Or you are realizing that the REST API would be an issue since custom kernel ids would, by default, be exposed and "available" for "actions" (interrupt, restart, shutdown) from different clients? Thanks. |
This was mostly an answer to that question:
To say that yes, if a custom
Thinking about it a bit more, it would probably be better to instantiate a separate kernel manager, and add extra handlers (for example So a regular |
We had a talk about this just now at the jupyter_server meeting. I love the idea of BYOKID
|
@jtpio - Thanks for the clarification - that all makes sense and seems reasonable to partition based on endpoints and instances.
That's my understanding, yes.
By creating their own instance of That said, this all feels a bit messy and heavy-handed. I thought there was a way for an extension to say - "I'm exclusive - no other extensions are allowed". Is that approach not viable? Also, please keep in mind that jupyter_server will be changing the implementation of |
Cool, then the separated handler can make sense.
load_other_extensions can be set to False, true. We had a lot of refactoring (and will continue...) - We need to make sure this is still working as expected in the 3 current ways to launch a server with an extensions ([1] jupyter server.... - [2] python. -m .... - [3] jupyter my_extension) |
There is some exploratory work for using a separate kernel manager (edit: when used as a server extension) in voila-dashboards/voila#41 (although this branch doesn't use the
Right, posting a link to the corresponding PR here for reference: #112
In the end BYOKID might not even be necessary for Voila if Voila always creates its own kernel manager (not decided yet if it's going to be case but still interesting to consider). However BYOKID might still be useful for other use cases. |
Sounds good Jeremy. Please note that even with kernel providers, you won't have the isolation that I understand you'd like unless splitting out the handlers and implementing your own MKM (or figuring out another way to make the separation exclusive to the respective clients). |
Hey folks,
Is it be possible to use custom kernel ids in an
ExtensionApp
, when starting a new kernel withself.kernel_manager.start_kernel()
?This seems to be supported in the base
MultiKernelManager
class injupyter_client
:https://github.com/jupyter/jupyter_client/blob/15b3b0566d962bbc042d21b858caeca2e870209a/jupyter_client/multikernelmanager.py#L130
However
jupyter_server
'sMappingKernelManager
handlesstart_kernel
a bit differently:https://github.com/jupyter/jupyter_server/blob/edc9dc211adbe27106a73b7f65989d2b0bdb604b/jupyter_server/services/kernels/kernelmanager.py#L168-L190
And will raise an exception when a new
kernel_id
is specified here:https://github.com/jupyter/jupyter_server/blob/edc9dc211adbe27106a73b7f65989d2b0bdb604b/jupyter_server/services/kernels/kernelmanager.py#L385-L386
I'm currently testing this with the
simple_ext1
extension, by adding the following code snippet to start new kernels on each request:To: https://github.com/jupyter/jupyter_server/blob/edc9dc211adbe27106a73b7f65989d2b0bdb604b/examples/simple/simple_ext1/handlers.py#L5-L11
The text was updated successfully, but these errors were encountered: