polerto
polerto

Reputation: 1790

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.

Upvotes: 3

Views: 6234

Answers (1)

hitman_93
hitman_93

Reputation: 116

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.

Upvotes: 4

Related Questions