codepod-io / codepod

Codepod IDE: Scalable Interactive Coding
https://codepod.io
MIT License
74 stars 15 forks source link

[Backend] Refactor ipynb kernel messages serialization #436

Closed senwang86 closed 1 year ago

senwang86 commented 1 year ago

Summary

Currently, the kernel messages are concatenated and stored in a single object, i.e., pod.result. This concatenation behavior creates a few discrepancy with Colab regarding the output results, e.g., it can't produce multiple plots in a single pod, the order of line execution might confuse users (see screenshots in Test section)

Test

Before

After

Screenshot 2023-08-04 at 10 41 10 PM

Follow-up

lihebi commented 1 year ago
  1. The stderr is not printed.
  2. Also, I'd like to keep the visual <hr/> to visually separate the stdout/stderr-stream and the return value.

Reference:

Screenshot 2023-08-05 at 1 12 34 PM

Old behavior:

Screenshot 2023-08-05 at 1 16 23 PM
lihebi commented 1 year ago
  1. The stderr is not printed.
  2. Also, I'd like to keep the visual <hr/> to visually separate the stdout/stderr-stream and the return value.

What do you say about these two issues? @senwang86 The rest of the code looks good to me.

senwang86 commented 1 year ago
  1. The stderr is not printed.
  2. Also, I'd like to keep the visual <hr/> to visually separate the stdout/stderr-stream and the return value.

What do you say about these two issues? @senwang86 The rest of the code looks good to me.

These 2 issues are addressed in the ab4818c, can you give it a test?

lihebi commented 1 year ago

Just tried, the order is not fixed. Two issues:

  1. the order should be 1,2,3
  2. there shouldn't be spaces in between (there are spaces after 3, and after 2)
Screenshot 2023-08-07 at 3 54 49 PM
senwang86 commented 1 year ago

Just tried, the order is not fixed. Two issues:

  1. the order should be 1,2,3
  2. there shouldn't be spaces in between (there are spaces after 3, and after 2)
Screenshot 2023-08-07 at 3 54 49 PM

Forget to mention about this, it depends on how Ipynb kernel handles the running result, the result is consistent with Colab.

Screenshot 2023-08-07 at 4 03 02 PM
lihebi commented 1 year ago

I see, SG.

senwang86 commented 1 year ago

I see, SG.

Spaces removed.

Screenshot 2023-08-07 at 4 29 36 PM
lihebi commented 1 year ago

Cool, thanks!