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

[Notebooks] Types for modal-kernelshim to publish outputs #2764

Merged
merged 3 commits into from
Jan 16, 2025

Conversation

ekzhang
Copy link
Member

@ekzhang ekzhang commented Jan 15, 2025

This allows the server to get outputs from running cells in modal-kernelshim.

Reference: https://jupyter-client.readthedocs.io/en/stable/messaging.html

Describe your changes

Why is this public protobuf? It's in here because kernelshim exists within the sandbox running user code. It can't access public information.

Why is this re-encoded in this funny way? It's part of the technical design that will allow us to implement collaborative editing and cloud-based kernels. (Also, on the server side, we'll need to figure out how to store potentially large outputs, possibly separate from other outputs.)

How will this be authenticated? Using an authentication passed into the sandbox. We could use task_id / task_secret, except sandboxes don't have that, so probably something else.

Notebook progress

Map of current progress. This PR is the yellow part.

Progress

This allows the server to get outputs from running cells in modal-kernelshim.
@ekzhang ekzhang requested review from mwaskom and luiscape January 15, 2025 21:46
Comment on lines 1924 to 1925
// See kernelshim.py for the differences between this and `ExecuteResult`.
// https://jupyter-client.readthedocs.io/en/stable/messaging.html#execution-results
Copy link
Member Author

@ekzhang ekzhang Jan 15, 2025

Choose a reason for hiding this comment

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

This isn't committed yet, here's an explanation

# The reply is not returned until after the cell finishes running. Although the
# `execute_result` output message contains the execution count and status, this is only
# returned by ipykernel if the last line of the cell evaluates to a non-null value.
#
# So, we still need to send this message to the server to get the true execution count
# for cells that do not produce an `execute_result` message.
reply = await pending

@ekzhang
Copy link
Member Author

ekzhang commented Jan 16, 2025

@prbot approve

Merging for now, still looking forward to feedback though! We discussed a bit in the office already. And after this we'll probably need to iterate further still.

Copy link

@modal-pr-review-automation modal-pr-review-automation bot left a comment

Choose a reason for hiding this comment

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

Approved 👍. @luiscape will follow-up review this.

@ekzhang
Copy link
Member Author

ekzhang commented Jan 16, 2025

@prbot approve

Merging for now, still looking forward to feedback though! We discussed a bit in the office already. And after this we'll probably need to iterate further still.

Copy link

@modal-pr-review-automation modal-pr-review-automation bot left a comment

Choose a reason for hiding this comment

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

Approved 👍. @mwaskom will follow-up review this.

@ekzhang ekzhang merged commit b81e8f9 into main Jan 16, 2025
23 checks passed
@ekzhang ekzhang deleted the ekzhang/protobuf-kernelshim branch January 16, 2025 17:01
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.

1 participant