A simple example of scheduling process gangs in Python?

I have a pool of processes that need to be completed. I would like to fully use the machine so that all processors execute the processes. I do not want to rewrite the system, so I really want: # executing_processes = # cpus at any time. I also need to save stdout, stderr and return code for all completed processes. How can this be achieved in Python?

EDIT: "process" I call the shell process.

+3
source share
1 answer

If you are talking about your own Python-implemented processes:

multiprocessing . , , multiprocessing.cpu_count , , Pool.

, :

subprocess Popen , stdin, stdout, sterr, . Popen.returncode .

+2

Source: https://habr.com/ru/post/1731830/


All Articles