title: Python multiprocessing. How do you get the status of the parent from the child?
body: <p>I'm writing an application (Linux) using the multiprocessing module, which spawns several children.  When a child dies, I can detect it from the parent using something like the following:</p>
  
  <pre><code>process = multiprocessing.Process(...)
  if process.is_alive():
    print "Process died"
  </code></pre>
  
  <p>However, I'd also like to be able to detect from the children if the parent is still alive, to handle cleanup if someone goes and kill -9's the parent process.</p>
  
  <p>From my example above, I can get the parent id with either:</p>
  
  <pre><code>process._parent_pid
  </code></pre>
  
  <p>Or:</p>
  
  <pre><code>os.getppid()
  </code></pre>
  
  <p>But I can't find an easy way to get a status of the process.  I'd rather not write something to grep/regex the ps list using subprocess.  Is there a cleaner way?</p>