I came across a scenario where i need to run the function parallely for a list of values in python. I learnt executor.map from concurrent.futures
will do the job. And I was able to parallelize the function using the below syntax executor.map(func,[values])
.
But now, I came across the same scenario (i.e the function has to run parallely), but then the function signature is different from the previous and its given below.
def func(search_id,**kwargs):
# somecode
return list
container = []
with concurrent.futures.ProcessPoolExecutor() as executor:
container.extend(executor.map(func, (searchid,sitesearch=site),[list of sites]))
I don't know how to achieve the above. Can someone guide me please?