The community member is having trouble displaying logs from a multithreaded library in run mode, as the library emits logs from different threads. They are unable to make it work with redirect_stdout. As the library is handling long-running tasks, the community member would like to have a dynamic display of the progress for the user.
Another community member acknowledges the issue and mentions that the kernel's underlying runtime context is thread-local, which was convenient for running marimo notebooks as apps, but now poses complications for regular threading. They indicate that they will think of a fix.
The community member who reported the issue expresses gratitude for the detailed explanations and the issue created to track the problem.
I would like, in run mode, to show logs from a multithreaded library that emits logs from different threads, but can't manage to make it work with redirect_stdout. As the library is handling long running tasks, it is useful for the user to have a dynamic display of the progress. I have attached a small file to reproduce.
The kernel's underlying runtime context is thread-local, which was convenient for us when running marimo notebooks as apps (each session runs in its own thread). Realizing now the complications this poses for regular threading ... will think of a fix.