Instead of passing the function and argument to apply_async
, the code calls multi_watershed
directly (in main process), and pass the return value of the function.
Pass the function and arguments.
Replace following line:
res = pool.apply_async(multi_watershed(val, key))
with:
res = pool.apply_async(multi_watershed, (val, key))