hoju
hoju

Reputation: 29452

Track process status with Python

I want to start a number of subprocesses in my Python script and then track when they complete or crash.

subprocess.Popen.poll() seems to return None when the process is still running, 0 on success, and non-zero on failure. Can that be expected on all OS's? Unfortunately the standard library documentation is lacking for these methods...

Is the subprocess module the most suitable to achieve this goal?

thanks

Upvotes: 3

Views: 4680

Answers (2)

Arkady
Arkady

Reputation: 15059

This may not be a very good answer to your question, but just in case you are at risk of reinventing a wheel, take a look at Supervisor

Supervisor is a client/server system that allows its users to monitor and control a number of processes on UNIX-like operating systems.

And it's all written in Python, so if you feel like tinkering with it, you can dig right in!

Upvotes: 4

nosklo
nosklo

Reputation: 222842

Yes to all.

Upvotes: 1

Related Questions