I am trying to implement a pipelining pattern with Python and ZeroMQ therefore I created the three components: producer
, consumer
and merger
So, I am able to send my tasks, consume (calculate square of a number), and then get my results.
My question is, if I have a list of tasks I plan to submit as a batch and I want them to be completed in a distributed pool of resources and merge the results, similar to multiprocessing apply/apply_async.
In native python, I typically use
...
def f(n):
return n*n
...
_r=[]
for i in xrange(1000):
_r.append(pool.apply_async(f,(i,)))
...
#get results
results = [ r.get() for r in _r ]
I am trying to emulate this into zeromq pattern
I am basing my producer
, consumer
, results
with this example. I also plan to have several servers as consumers since its a long running task therefore I have looked at the load-balancing pattern and the daunting cluster pattern. Is this necessary for zero mq?