-
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
Kernel providers #112
Kernel providers #112
Conversation
@kevin-bates cc/ @Zsailer Tested successfully this branch with notebook as server extension - Cells can be executed. conda create -y -n jupyter-kernel-mgmt python=3.7 nodejs && \
conda activate jupyter-kernel-mgmt && \
git clone https://github.com/takluyver/jupyter_kernel_mgmt --branch master --single-branch --depth 1 && \
cd jupyter_kernel_mgmt && python setup.py develop && cd .. && \
git clone https://github.com/kevin-bates/jupyter_server.git --branch jupyter-kernel-mgmt --single-branch --depth 1 && \
cd jupyter_server && python setup.py develop && cd .. && \
git clone https://github.com/zsailer/notebook.git --branch notebook-ext --single-branch --depth 1 && \
cd notebook && python setup.py develop && cd .. && \
jupyter notebook
# open http://localhost:8888/tree |
b07189b
to
a03eda3
Compare
Does this change the notebook rest api in any way, or is this change transparent to clients? |
Hi @jasongrout. This does not change the rest api. However, the provider id (identifying the kernel provider) is returned as a prefix to the kernel name when retrieving kernelspecs. Thomas, in his Notebook PR, added some client-side updates to display both the kernel display name and its provider-id-prefixed "symbolic-name". So long as this name is used in subsequent apis (like when starting a kernel), all is fine. The server picks off the prefix to determine on which provider launch should be called. Down the road, I suppose a client may want to interpret the prefix (from an organization standpoint, or something), but that's not required and @echarles' comment above appears to confirm that things work okay in this area. EDIT: As noted below "work okay" is probably pushing things. We need to figure out why the kernel name isn't being updated and why the resource files (icons) aren't being pulled. EDIT2: This experiment suggests that the use of |
hmm, @echarles - are you seeing the kernel name and its icon in the upper right corner (for notebook) or on the launch page (for lab)? when I expect to see |
@kevin-bates It also shows I understand there is a consensus to not focus on Notebook (which should live its own life) but rather onboard JupyterLab on server. There are 2 actions for this:
|
@echarles - thanks for the update - that's helpful info. Just to clarify, Notebook "complete" (i.e., Notebook as we know it today - server and client combined) - will live its own life. However, there are plans to provide a notebook server-extension for use on jupyter-server. I hope to get further clarification in Thursday's Jupyter Server community call. Regarding the kernel name changes, my initial thought was that the kernel name isn't getting url-encoded to encode the '/' that now separates the provider-id from the kernel name. However, why then am I not seeing The other reason Thomas probably included the provider id in the kernel drop down menu is because it's now possible to have two kernels with the same Here's a snippet of these two kernelspecs: "pyimport/kernel": {
"name": "pyimport/kernel",
"spec": {
"language_info": {
"name": "python",
"version": "3.6.6",
"mimetype": "text/x-python",
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"pygments_lexer": "ipython3",
"nbconvert_exporter": "python",
"file_extension": ".py"
},
"display_name": "Python 3",
"argv": [
"/opt/anaconda3/envs/jupyter-server-dev/bin/python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"resource_dir": "/opt/anaconda3/envs/jupyter-server-dev/lib/python3.6/site-packages/ipykernel/resources",
"language": "python"
},
"resources": {
"logo-64x64": "/kernelspecs/pyimport%2Fkernel/logo-64x64.png",
"logo-32x32": "/kernelspecs/pyimport%2Fkernel/logo-32x32.png"
}
},
"spec/python3": {
"name": "spec/python3",
"spec": {
"language_info": {
"name": "python"
},
"display_name": "Python 3",
"argv": [
"python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"resource_dir": "/opt/anaconda3/envs/jupyter-server-dev/share/jupyter/kernels/python3",
"metadata": {},
"language": "python"
},
"resources": {
"logo-64x64": "/kernelspecs/spec%2Fpython3/logo-64x64.png",
"logo-32x32": "/kernelspecs/spec%2Fpython3/logo-32x32.png"
}
}, |
@kevin-bates just wanted to let you know I'm not ignoring this PR. 😄 I've been catching up on all the previous conversation around this work 😅 I realized I didn't fully understand everything going on here. I'll review some more once I get up to speed! |
@Zsailer - no worries. There are still plenty of kinks to work out - so its still early. |
It's always been possible, though these changes will probably make it more common. |
cc @jasongrout @martinRenou @maartenbreddels we need to review this in details as it has broad implications for voila, and the other issues that we are having with jupyter_client and kernels lifecycle. |
@SylvainCorlay I am trying this branch with classic notebook, jupyterlab and voila. Indeed, as voila server interacts directly with the kernel api, there is some impact on voila side. I have started to implement something but paused in the middle of the road to concentrate for now on jupyterlab in first instance. |
@kevin-bates the good news is that async is merged by @takluyver The bad news is that it breaks the kernel launch when used in the notebook with
|
@echarles - yep - I figured that would happen. You'll need to pin to the current released jupyter_kernel_mgmt until async support is in the server. I believe I have a branch for this relative to notebook, so it should "transfer" fairly easily. |
29a650b
to
1ab14b1
Compare
Regarding the kernel name/icon images in Notebook classic... @jasongrout, @takluyver - do you know why the client-side code wouldn't just use the |
@kevin-bates I am testing your last commit for the async fix but still get the error |
Yes. That's expected because I haven't converted the touch points in server to be asynchronous. Rather than work from the tip of kernel-mgmt, install the released version and try that, although I can't guarantee there weren't changes between the release and async merge. |
234d09d
to
f3ecf87
Compare
@kevin-bates Thx for your answer. I am also in favor of squashing. Less noise in the git history, more chance for the other branches to resolve conflicts. I remember @Zsailer mentioned guys like to show their activity (especially if their boss asks for), but the history is still in the PR is I am not mistaken. I have seen also companies counting the number of lines their staff have contributed... |
Closing this since the corresponding JEP has been closed. |
* pass token from login to notebook_service_client * Bump to 0.10.2
Was this ever merged? And how does one enable automatic finding of conda environments with ipykernel as Jupyter kernels? Is nb_conda_kernels that is deprecated still the only way? |
Hi @nreith. No - this was not merged. Instead, the notion of kernel provisioners was implemented in I didn't realize that |
To be honest with you, it works fine. But whenever possible, I like to use the official method, and stick to projects that are actively developed. My main reason is I use jhub and related stuff for work, in as close to a "prod" grade situation as we can muster, on k8s, with load balancing and a secondary cluster for failover, etc., etc. In an enterprise setting, we always get harassed with a lot of compliance and security vulnerabilities, etc. That's my main reason for staying close to the active repos. This seems to be a newer fork (https://pypi.org/project/nb-conda-store-kernels/), but very focused on conda-store? whatever that is. If you don't know of a way for the standard Anyway, we can use old stuff and fork and patch ourselves if needs be. But I'm open to any suggestions. The automation + critically the env vars, is what is good about |
Like @nreith, I am also interested if there is any recommended ("official") way for discovering kernels and their context/environment settings. @kevin-bates The actual question I have at this point is: should we (whoever "we" is) try to reactivate |
Hi @chbrandt.
I think that's the best approach right now. Ideally, this would be addressed via parameterization, where the user is prompted from a set of environments and a custom kernel provisioner (or even perhaps via extension to the |
@kevin-bates So you are saying to leverage the new jupyter-client provisioners machinery instead of trying to update the old-way done by nb_conda_kernels that was extending the KernelManager, right? |
Hi @kevin-bates, @echarles, To share one thing I noticed: nb_conda_kernels has entrypoint at
|
nb_conda_kernels works fine in my experience. no issues in 6 months though
it is old code
…On Thu, Jun 29, 2023, 11:24 AM Carlos H Brandt ***@***.***> wrote:
Hi @kevin-bates <https://github.com/kevin-bates>, @echarles
<https://github.com/echarles>,
To share one thing I noticed: nb_conda_kernels has entrypoint at
jupyter_client.kernel_providers, whereas jupyter_client expects an entry
at jupyter_client.kernel_provisioners. There is no reference to
"kernel_providers" in the docs anymore (
https://jupyter-client.readthedocs.io/en/latest/search.html?q=kernel_providers).
In nb_conda_kernels's discovery.py module says "Initial support for the
kernel provider mechanism to be introduced in jupyter_client 6.0".
- jupyter_client.kernel_providers:
https://github.com/Anaconda-Platform/nb_conda_kernels/blob/f461d2159a970fec323f0c225557e74c63c6a45b/setup.py#L16
- jupyter_client.kernel_provisioners:
https://jupyter-client.readthedocs.io/en/latest/provisioning.html#discovery
- discovery.py:
https://github.com/Anaconda-Platform/nb_conda_kernels/blob/f461d2159a970fec323f0c225557e74c63c6a45b/nb_conda_kernels/discovery.py#L2
—
Reply to this email directly, view it on GitHub
<#112 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABPP44PYOEDYTIBVUICOEFTXNWT3JANCNFSM4I5U5FKQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@chbrandt @nreith Maybe open an new issue on https://github.com/Anaconda-Platform/nb_conda_kernels (ping me/us on that, this issue is closed and the repo is not the one to have that discussion) - Please note also anaconda/nb_conda_kernels#151 which was a discussion started 4 years ago but for the previous attempt called |
No. I am saying that the current approach should be used. I also added that, "ideally, this would be addressed via parameterization" once parameterization is available. Parameterization is NOT currently available. I then suggested that, when available, a custom provisioner could be used to create the environment (also suggesting we could explore extending or using the Regarding Kernel provisioners came about as a means to address the lifecycle management portion of kernels, but does not include discovery - which is still the purview of Since nb_conda_kernels is essentially a custom |
These changes replace the kernel and kernel spec management with the jupyter kernel management framework originally proposed by Thomas Kluyver (@takluyver). This framework essentially replaces
jupyter_client
with two libraries - refactored to address some of the issues with the current class organization -jupyter_kernel_mgmt
andjupyter_protocol
.Upon completion, this pull request will include the following:
Cherry-pick Notebook PR WIP: Use new kernel management APIs in notebook server 6.x jupyter/notebook#4837
Details
These are the commits included. Their hashes can be found on this branch:
https://github.com/takluyver/notebook/tree/jupyter-kernel-mgmt
Note: Because jupyter server does not include client-side code, some of these commits were not included. However I believe those were merely needed to also display the new "provider id" and kernel name, along with the display name. Further investigation is required to determine if those changes are required, but I suspect they aren't.
plus a couple fixups from cherry-pick conflict resolution issues.
Finish removal of
jupyter_client
Fix tests
Replace use of
KernelSpecManager
inGateway
package to useKernelFinder
and confirm functionality to remote gateway serverAdd async support (since async functionality recently merged into kernel-mgmt)
jupyter_kernel_mgmt
dependency to>= 0.5.0
once PR 31 is merged and release is built.Provide dev build of server for others to experiment with (see Kernel providers #112 (comment))
Add plumbing for conveying launch parameters to kernel providers (parameterized kernel support)
Identify necessary changes to support provider id in Notebook classic (Lab works fine, although we probably want to convey provider Ids somehow). See this commit. Thank you @echarles!
Enumerate known incompatibilities...
KernelManager
andKernelSpecManager
classes can no longer be overridden. Applications wishing to customize KernelSpecs need to author a Kernel ProviderMappingKernelManager
can apply configurable information to kernel lifecycle. Configuration (traitlets) were intentionally omitted from the framework. Providers can, however, obtain access to the Application configurable instance enabling the ability for applications to convey configuration information to providers.KernelSpecManager.whitelist
will need to be configured differently as the class no longer exists.--transport
, which maps toKernelManager.transport
and defaults to'tcp'
(other option is'ipc'
) is no longer supported directly since 'transport' is a function of the kernel provider although a launcher implementation is provided.... other items will be added as things unfold
Closes: #90