STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
engine.layerx.capture Namespace Reference

Classes

class  _ThreadRouter

Functions

None _install ()
Iterator[io.StringIO] thread_stdout ()

Variables

 _local = threading.local()
 _install_lock = threading.Lock()

Detailed Description

Capture what one thread prints, without touching any other thread's output.

``contextlib.redirect_stdout`` swaps ``sys.stdout`` for the whole process. In the API, burns run on
daemon threads two at a time: two overlapping flights restored each other's buffers, and the
server went on printing into a StringIO for ever while other requests' prints landed in a run's
notes. Here ``sys.stdout`` is replaced once by a router that sends a thread's writes to that
thread's buffer while it is capturing, and everything else to the real stream.

Function Documentation

◆ _install()

None engine.layerx.capture._install ( )
protected

Definition at line 45 of file capture.py.

Referenced by thread_stdout().

◆ thread_stdout()

Iterator[io.StringIO] engine.layerx.capture.thread_stdout ( )
Everything this thread prints inside the block, and nothing any other thread prints.

Definition at line 52 of file capture.py.

References _install().

Variable Documentation

◆ _install_lock

engine.layerx.capture._install_lock = threading.Lock()
protected

Definition at line 19 of file capture.py.

◆ _local

engine.layerx.capture._local = threading.local()
protected

Definition at line 18 of file capture.py.