Skip to content

Conversation

@ellisonbg
Copy link
Collaborator

This PR adds server side outputs handling. There are two different server components in this PR that work together to process outputs on the server:

  • OutputProcessor. This class intercepts incoming and outgoing kernel messages and tracks which messages are related to which cells (by cell_id). When output messages are sent from the kernel back to the frontend, this class instead transforms the outputs messages into nbformat outputs and saves them to the server side ydoc.
  • OutputsManager. Optionally, the output processor can push outputs to the outputs manager. This class saves the outputs to disk and exposes and rest API. When this is done, the actual output saved to the server ydoc is empty but points to the URL of the output in the output service.

Copy link
Collaborator

@knaresh knaresh left a comment

Choose a reason for hiding this comment

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

Comments can addressed in followup. I am ok to push this asis

Comment on lines +12 to +15
_cell_ids = Dict(default_value={}) # a map from msg_id -> cell_id
_cell_indices = Dict(default_value={}) # a map from cell_id -> cell index in notebook
_file_id = Unicode(default_value=None, allow_none=True)

Copy link
Collaborator

Choose a reason for hiding this comment

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

are entries ever deleted?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes the clear method of this class is called in certain cases. Also, the entire instance goes away when the kernel is shutdown.

@ellisonbg ellisonbg merged commit 04c7852 into main May 13, 2025
2 of 6 checks passed
@ellisonbg ellisonbg deleted the outputsv2 branch May 13, 2025 23:40
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.

3 participants