Closed Beatris closed 4 years ago
The intent in both Enlighten and Blessed is that most of the code for interacting with the console lives in the parent process. You'd then pass updates to the parent through some sort of IPC. One way I've seen this done is to have the children write back to a queue and have the parent process (or a status process) loop through all the queues each 0.1 second to grab any updates. If you send the absolute numbers, you can just run Counter.update() on the last one in the queue.
There's also the possibility of sharing the enlighten manager or counter objects through a customized implementation of multiprocessing.managers.BaseManager, but I haven't tried it.
If I get some time I can try to create some example code. It would probably be useful to have in the documentation anyway. For now, just think in terms that you should only call get_manager() once within your program for all processes.
I added an example using queues. There are a lot of ways to do this, really depends on the design of your program.
Going to close this. Let me know if you run into any more issues or have suggestions on how we can make it easier.
We have code executed by multiple parallel processes and when I call
get_manager
from it the below exception is raised. It seems as race condition in the blessed library but I haven't investigated it further.