This
args = (paths, finput)
pool.map_async(bruteForcePaths2, args)
makes these two calls, which is not your intent:
bruteForcePaths2(paths)
bruteForcePaths2(finput)
You can use apply_async
instead to submit single function calls to the pool. Note also that if you call get
immediately it will wait for the result, and you don't get any advantage from multiprocessing.
You could do it like this:
for i in range(1,len(availableNodes)+1):
currentCombos = combinations(availableNodes, i)
for finput in grouper_nofill(chunksize,currentCombos):
args = (paths, finput)
async_results.append(pool.apply_async(bruteForcePaths2, args))
results = [x.get() for x in async_results]