-
Notifications
You must be signed in to change notification settings - Fork 8
Adopt nextgen-kernels-api for kernel client management #170
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
Open
Zsailer
wants to merge
8
commits into
jupyter-ai-contrib:main
Choose a base branch
from
Zsailer:nextgen-kernels-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4b82d0c to
01217ca
Compare
Collaborator
Author
|
The integration test failure is unrelated. I'm seeing this in other places as well. It looks like an error with transitive dependencies in other places in the JupyterLab stack. |
Collaborator
be7cb49 to
3b7dabc
Compare
add5751 to
8891e81
Compare
Replace custom kernel management implementation with nextgen-kernels-api. Use message filtering to route outputs to processor while excluding them from websocket clients. Configure kernel client via traitlets instead of subclassing.
…state sync - Replace message_cache with extract_src_id/extract_channel utilities - Remove obsolete test_kernel_message_cache.py - Fix awareness sync to send execution states to reconnecting clients - Add cell_msg_ids tracking for re-execution detection
8891e81 to
62cb152
Compare
Collaborator
Author
|
I've opened jupyter-server/jupyter_server#1570 which would remove the need for this PR. |
Override get_session() to verify and restore yroom-to-kernel-client connections. This is critical for persistent/remote kernels that survive server restarts, where the in-memory yroom connection may be lost even though the session and kernel remain valid. - Add _ensure_yroom_connected() method to handle connection logic - Make connection verification idempotent to avoid duplicate connections - Handle edge cases gracefully with logging but no exceptions - Improves reliability when reconnecting to persistent kernel sessions
…ection logic Tests cover: - Cached room_id usage and reconstruction from database - Non-notebook session handling - Idempotency (avoiding duplicate connections) - Edge cases (missing yrooms, sessions without kernels) - get_session() integration with _ensure_yroom_connected() These tests verify the critical functionality for maintaining yroom-kernel connections for persistent kernels across server restarts.
Fixed issues with test fixture mocking: - Use LoggingConfigurable parent class for proper traitlets compatibility - Mock parent class's get_session method instead of YDocSessionManager's - Make kernel_client.add_yroom an AsyncMock for proper async behavior All 9 tests now pass successfully.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
This PR replaces the custom kernel client implementation in
jupyter-server-documentswith nextgen-kernels-api, a more extensive and reusable implementation of the Jupyter kernel protocol.Key Changes
kernels/directory and associated tests)nextgen-kernels-api >= 0.6.0Why nextgen-kernels-api?
The
nextgen-kernels-apilibrary aims to provide a robust, well-tested kernel client implementation that:jupyter-server-documentsdepends on a stable interfacejupyter-server-documentscan leverage the same kernel client implementationThere's an open discussion about moving
nextgen-kernels-apiinto thejupyter-ai-contriborg: https://github.com/orgs/jupyter-ai-contrib/discussions/5Technical Details
The PR:
MultiKernelManagerandKernelManagervia traitlets to useDocumentAwareKernelClientmsg_types,exclude_msg_types) to route messages efficientlyTesting
All existing tests pass. The custom kernel tests were removed as they tested implementation details now handled by
nextgen-kernels-api.Diff stats: 24 files changed, 294 insertions(+), 1981 deletions(-)