Skip to content

Conversation

@dlqqq
Copy link
Collaborator

@dlqqq dlqqq commented May 14, 2025

Description

  • Addresses Cannot stop server with Ctrl + C #41 (only fixes it after opening non-notebook files).
  • Implements the stop() method on YjsClientGroup, YRoom, YRoomFileAPI, and YRoomManager.
  • YRoom.stop() finishes applying all Yjs updates in the message queue, then saves the final content of the YDoc to disk.
  • YRoomManager.stop() deletes all YRoom instances, calling YRoom.stop() in the process.
  • Implements the stop_extension() method on RtcExtensionApp.

NOTE: the server will still hang on Ctrl + C after opening any notebook. Presumably this is due to the custom kernel & session managers we are providing.

Testing instructions

  • Stop all instances of jupyter lab using kill -9 <PID>
  • Run reset to reset the state of your terminal in case it was corrupted by kill -9
  • Run jupyter lab and open a text file (server will still hang after opening a notebook)
  • Press Ctrl + C twice and verify that the server extension stops immediately.

Demo

This also includes a build of the frontend changes from #46, which is what opens the dialog immediately when the server extension stops.

Screen.Recording.2025-05-15.at.11.46.34.AM.mov

Open questions

  • @Zsailer @knaresh Are these instances supposed to stop automatically when the server extension stops, or is there some kind of method we should call in RtcExtensionApp.stop_extension()? I don't see a stop() method on these interfaces (e.g. SessionManager and AsyncKernelManager).
c.ServerApp.kernel_websocket_connection_class = "jupyter_rtc_core.kernels.websocket_connection.NextGenKernelWebsocketConnection"
c.ServerApp.kernel_manager_class = "jupyter_rtc_core.kernels.multi_kernel_manager.NextGenMappingKernelManager"
c.MultiKernelManager.kernel_manager_class = "jupyter_rtc_core.kernels.kernel_manager.NextGenKernelManager"
c.ServerApp.session_manager_class = "jupyter_rtc_core.session_manager.YDocSessionManager"
  • @Zsailer @knaresh Can you all address this in a future PR? I can test with text files exclusively for now.

@dlqqq dlqqq changed the title WIP: Allow server to be stopped via Ctrl + C Allow server to be stopped via Ctrl + C May 15, 2025
@dlqqq dlqqq changed the title Allow server to be stopped via Ctrl + C Allow server to be stopped via Ctrl + C after opening text files May 15, 2025
@dlqqq
Copy link
Collaborator Author

dlqqq commented May 15, 2025

@jzhang20133 Thanks for the feedback! I've pushed some changes & addressed all of your feedback.

@Zsailer
Copy link
Collaborator

Zsailer commented May 15, 2025

@dlqqq I can work on the cleanup for kernel client in a follow-up PR. Merging this one here!

@Zsailer Zsailer merged commit abea3e6 into jupyter-ai-contrib:main May 15, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants