Skip to content

Commit

Permalink
detach io thread output from creation cell
Browse files Browse the repository at this point in the history
  • Loading branch information
minrk committed Oct 29, 2024
1 parent d7713f6 commit 51ae59f
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions ipyparallel/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import re
import socket
import sys
import time
import types
import warnings
Expand Down Expand Up @@ -1078,6 +1079,13 @@ def _io_main(self, start_evt=None):
"""main loop for background IO thread"""
self._io_loop = self._make_io_loop()
self._setup_streams()

# disable ipykernel's association of thread output with the cell that
# spawned the thread.
# there should be a public API for this...
for stream in [sys.stdout, sys.stderr]:
if getattr(stream, "_thread_to_parent", None):
stream._thread_to_parent.pop(current_thread().ident, None)
# signal that start has finished
# so that the main thread knows that all our attributes are defined
if start_evt:
Expand Down

0 comments on commit 51ae59f

Please sign in to comment.