I am trying to execute this python script for implementing a distributed computing protocol. Currently this executes the functions sequentially one after the other. i want to be able to run all the processes parallel on different ports instead of the ** multiprocessing.Manager().Queue()** as has been mentioned in the statement below but i have no clue how should i go about. Any head start would be appreciated to lead me in the right direction
import multiprocessing
from threading import Thread
class Process(Thread):
def __init__(self, env, id):
super(Process, self).__init__()
self.inbox = multiprocessing.Manager().Queue()
self.env = env
self.id = id
def run(self):
try:
self.body()
self.env.removeProc(self.id)
except EOFError:
print "Exiting.."
def getNextMessage(self):
return self.inbox.get()
def sendMessage(self, dst, msg):
self.env.sendMessage(dst, msg)
def deliver(self, msg):
self.inbox.put(msg)
i was able to run this code in parallel mode by implementing simple socket programming instead of Queues by following the python documentation and then making the communication of messages possible over those sockets.