-
Notifications
You must be signed in to change notification settings - Fork 29.5k
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
Changes to how stream outputs are handled in Notebooks #161023
Comments
@roblourens @rebornix /cc |
Thanks for the nice write-up. Some follow questions/idea
I see the |
I only included those because we seemed to have a few of those streams. I agree the only one we need to merge are for
Unfortunately I don't recall this.
No didn't, i was primarily focused on merging the stream output items into single item. |
Related issues #146768, microsoft/vscode-jupyter#11031
Multiple Output Items per Output
This is check is done in
extHostTypes.ensureUniqueMimeTypes
I.e. if you were to call
appendOutputItem
withstdout
multiple times, only the firststdout
is stored in the model.E.g. if you were to call
appendOutputItem
withstdout
twice with the values1
and2
respectively, then you'd end up with a single output item with the value1
in the model. The secondstdout
output item is ignored.Changes to the API
We will support calling
appendOutputItem
multiple times for the same stream mime types per output.However we'd merge the stream output items into one and we'd still end up with a single output item per mime type.
E.g. if you were to call
appendOutputItem
withstdout
twice with the values1
and2
respectively, then you'd end up with a single output item with the value12
in the model.This change applies only to the stream mime types which include:
Current approach
Summary: Jupyter extension gets new output for each cell and compresses/merges the outpu items, and replaces the existing output with new output. E.g. if you get a new stream output, we replace the previous output items with a new one.
Draw backs:
Why do we need to merge/compress outputs
Assume we get output from the kernel as follows:
Line1
.ESC[ALine2
ESC[ALine3
Note: Assume
ESC[A
is a special terminal escape sequence that tells the terminal to remove the previous line.Thus when we get the output
ESC[ALine3
, what needs to be displayed isLine3
and sameLine3
saved in*.ipynb
file (the prevous lines need to be dropped).This compression/merging of outputs needs to happen in realtime, so users can see updates from terminal progress bars & the like (very common in Jupyter, installing packages and running experiments).
Proposed Solution
Summary: We send the incremental updates to Renderer process. And instead of appending the new items we compress the new output items with the existing items and replace the existing items with a single output item. I.e. we always have one output item in the cell output.
Draw backs:
Current API method is
appendOutputItems
. Today this only supports having multiple output items with distinct mime types. If one were to call the API with the same mime type, the the new items get dropped.The change here allows us to call
appendOutputItems
for the same mime type again without losing this data and this applies to streams mime types.Optionally we could have a new method
appendStreamOutputItems
to be more explicit about the fact that we have special handling for stream output items.Benefits:
Solution that we tried and found to not work well
Summary: We send the incremental updates to Renderer process. I.e. we always append output items. As we get new items this list of output items will grow.
Draw backs:
*.ipynb
file.Note: We have tried this approach and the results are not good. Basically VS Code is busy processing a large list of output items and this slows other parts of notebook.
Benefits:
The text was updated successfully, but these errors were encountered: