Quantcast
Channel: Active questions tagged return-value - Stack Overflow
Viewing all articles
Browse latest Browse all 209

How to catch the duration and return value of many python parallel sub-process

$
0
0

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


Viewing all articles
Browse latest Browse all 209

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>