Skip to content
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

Add Reticulate support to the kernel supervisor #5854

Merged
merged 15 commits into from
Jan 3, 2025

Conversation

jmcphers
Copy link
Collaborator

This change makes it possible to use Reticulate sessions with the kernel supervisor.

image

The supervisor has a new adopt endpoint that allows it to connect to a session that is already running somewhere else. Now, when you start a Reticulate session, the following things happen:

  • An R session is started, if necessary.
  • A Reticulate session is started inside the R session.
  • The Python kernel is started inside the Reticulate session.
  • The supervisor "adopts" the Python kernel, connecting to its ZeroMQ sockets and proxying messages as it does for other kernels.

In addition to adding the orchestration to use the supervisor, there are a couple of other small changes in this PR:

  • There is a new Restart the Kernel Supervisor command, which shuts down the supervisor process and all sessions, regardless of what state they're in. This is mostly intended as a debugging tool, and it was added in order to make it possible to pick up e.g. debug log level changes without restarting Positron, but could also be helpful as a last resort if things get stuck.
  • The progress shown when starting a Reticulate session is now much more chatty; it appears as soon as you try to start the session and shows more information along the way.

Progress towards #4579; this enables the use of Reticulate on Posit Workbench, and is the last major piece of functionality that required the Jupyter Adapter.

(Note that the main body of this change lives in the supervisor itself; this is just the front end / UI bits.)

QA Notes

There's a lot of orchestration involved already in starting Reticulate and this makes it even more complicated. The highest risk areas are around lifecycle management: shutting down, restarting, reconnecting, etc.

There is a known issue in which if you have an exited R session in your Console and try to start a Reticulate session, it never happens. I didn't try to fix that in this PR.

Copy link

github-actions bot commented Dec 23, 2024

E2E Tests 🚀  ?
This PR will run tests tagged with: @critical

@jmcphers jmcphers requested a review from dfalbel December 23, 2024 20:22
@jmcphers jmcphers marked this pull request as draft December 23, 2024 21:22
@jmcphers jmcphers marked this pull request as ready for review December 23, 2024 23:05
Copy link
Contributor

@dfalbel dfalbel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Tested locally and everything worked as expected.

@jmcphers jmcphers merged commit 5c9342e into main Jan 3, 2025
25 checks passed
@jmcphers jmcphers deleted the feature/reticulate-supervisor branch January 3, 2025 18:30
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants