So I’ve got this spun-off process (forked) that takes about 2-3 minutes to complete. The function that makes it happen returns its PID to me. Works great (thanks to the dude at work). I want to keep track of that process, so I’m hooking up the
… to get some info (e.g., percent complete) at five-second intervals.
The os.waitpid() returns (0, 0) when the process is running, (PID, 0) once the process has finished, and an OSError (ERRNO 10: No children) when the process doesn’t exist (after finishing). This all works fine and dandy through the command-line Python interpreter, and I’m handling each case appropriately… returning ‘running’, ‘stopped’ or ‘no process’ depending on the output.
My question is: Why does this work inconsistently in Zope? The process will run to completion on the box, but in the middle of it, my status function will return ‘no process’ instead of ‘running’ for 6-10 checks, then go back to ‘running’… and sometimes, just stay ‘no process’ forever, never giving me the ever-important ‘stopped’.