In my code there are a number of functions called func1, func2, func3, and so on... I'm using multiprocessing pool to call the functions and make them run parallel. The code looks like this:
def func1():
...
def func2():
...
if __name__ == '__main__':
with Pool(processes=2) as pool:
r1 = pool.apply_async(func1, ())
r2 = pool.apply_async(func2, ())
var1 = r1.get(timeout=20)
var2 = r2.get(timeout=20)
I need to increase the number of functions and I was thinking of using some king of loop to call those functions. How could this be done?