def start_server_process(self):
    self.pid = os.fork()
    if self.pid != 0:
      logging.info("Started SimpleThriftServer (pid %s) on port %s" %
                   (self.pid, self.port))
      self._ensure_online()
      return

    # Child process runs the thrift server loop
    try:
      processor = TestService.Processor(self)
      transport = TSocket.TServerSocket('localhost', self.port, socket_family=self.socket_family)
      server = TServer.TThreadedServer(processor,
                                       transport,
                                       TBufferedTransportFactory(),
                                       TBinaryProtocolFactory())
      server.serve()
    except:
      LOG.exception('failed to start thrift server')
      sys.exit(1)
Starts a test server, returns the (pid, port) pair.
dataset/ETHPy150Open cloudera/hue/desktop/core/src/desktop/lib/thrift_util_test.py/SimpleThriftServer.start_server_process