I am using multiprocessing pool.starmap
function. I discover a strange issue.
from multiprocessing import Pool
p = multiprocessing.Pool()
NODE = [1,2,3,4];
PageRank = [0.25,0.25,0.25,0.25];
Destination = [[2,3,4],[3,4],[1,4],[2]];
Data = zip(NODE,PageRank,Destination)
So I use zip
function to create a data set Data
, which is a list with each entry being a tuple of length 3. Then I call the function
p.starmap(MyFunction, zip(NODE,PageRank,Destination))
It works great.
However, when I type
p.starmap(MyFunction, Data))
It output empty list []
!!!! I really have no clue what is going on. I literally just replaced zip(NODE,PageRank,Destination)
by Data
, which should be the same thing, right?
Is that because I am using Jupyter notebook that causes this?