def stop_server_process(self):
    if self.pid == 0:
      return

    try:
      logging.info("Stopping SimpleThriftServer (pid %s)" % (self.pid,))
      os.kill(self.pid, 15)
    except Exception, ex:
      logging.exception("(Potentially ok) Exception while stopping server")
    os.waitpid(self.pid, 0)
    self.pid = 0
Stop the server
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/thrift_util_test.py/SimpleThriftServer.stop_server_process