Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Message passing between processes using multiprocessing module

What's the recommended way of sending message from a worker process to another randomly selected (worker or master) process? One approach that I can think of is using Pipes, but since it can only create a pipe between two selected processes, I need to create a pipe for each process pair. This doesn't seem so practical. What I want is to create a complete graph between processes and select one of the pipes randomly.

like image 542
polerto Avatar asked May 09 '26 22:05

polerto


1 Answers

You could use Queue in order to communicate among your processes by maintaining some convention in your queue.Your could find the details on using Queue here.

P.S :- As mentioned here Queues are thread and process safe.

like image 197
hitman_93 Avatar answered May 11 '26 11:05

hitman_93



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!