Repository navigation
[Python] Move the JupyROOT output capture and executors to Python - #23825
Open
guitargeek wants to merge 1 commit into
Open
guitargeek wants to merge 1 commit into
guitargeek wants to merge 1 commit into
Conversation
IOHandler.cxx captured the stdout and stderr of C and C++ code in notebooks by redirecting the file descriptors into pipes, and ran notebook cells through TInterpreter, reporting C++ exceptions. Both are now Python: the capture with os.dup2() and pipes, the cell execution through gInterpreter, with cppyy translating C++ exceptions. The capture used to read the pipes only after flushing C stdio, so a cell that wrote more than the pipe holds (64 kB on macOS) hung: the writer blocked on the full pipe holding the stream lock that the flush waited for. Now a thread per stream drains its pipe as long as the capture runs. A process started during the capture can keep a pipe open, so the end of a capture waits at most a second for the rest of the output. Other differences: - each IOHandler has its own capture, instead of all sharing one, which the first one to be deleted destroyed; - deleting an IOHandler ends its capture; - output that is not valid UTF-8 is decoded with replacement characters instead of raising; - ProcessLine() and Declare() release the GIL (set in the facade), so the ROOT kernel streams output while a cell runs. 🤖 Done with the help of AI
Test Results 2 files 2 suites 4h 59m 35s ⏱️ Results for commit 3fecbbf. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IOHandler.cxx captured the stdout and stderr of C and C++ code in notebooks by redirecting the file descriptors into pipes, and ran notebook cells through TInterpreter, reporting C++ exceptions. Both are now Python: the capture with os.dup2() and pipes, the cell execution through gInterpreter, with cppyy translating C++ exceptions.
The capture used to read the pipes only after flushing C stdio, so a cell that wrote more than the pipe holds (64 kB on macOS) hung: the writer blocked on the full pipe holding the stream lock that the flush waited for. Now a thread per stream drains its pipe as long as the capture runs. A process started during the capture can keep a pipe open, so the end of a capture waits at most a second for the rest of the output.
Other differences:
🤖 Done with the help of AI