I need to write some code in python that launches 8 processes in parallel and that, for each process, is able to report their return value and their duration in microseconds.
Unfortunately I don't know how to do it.
I imagined launching the processes with:
p = subprocess.Popen([f"{my_process}"], shell=True, universal_newlines = True, stderr=subprocess.STDOUT, stdout=DEVNULL)
and waiting for their termination with:
p.wait()
measuring their start and stop time with:
datetime.now()
but what I don't know how to do is capture the durations of each process in parallel, also taking the return value of each.
Do you think this task is too difficult for python?I guess not, but I can't get out of it!
Can someone help me please?
Thanks