Consider you want to launch in a loop several parallel processes in async way, and of course, get for each process its exit code and prints.
If we do something naive like:
i = 5
While i > 0:
p = sp.Popen(["./my_module.py", "arg1", "arg2"], stdout=sp.PIPE, stderr=sp.PIPE)
out, err = p.communicate()
result = p.returncode
i -= 1
This probably not work async because of communicate
blocking method above.
Any ideas for the best simple way to achieve multiple processes allocation async way, and finally getting their results accumulated in list or something?