def run(self):
    self._logger.info('starting pailgun server on port {}'.format(self.pailgun_port))

    try:
      # Manually call handle_request() in a loop vs serve_forever() for interruptability.
      while not self.is_killed:
        self.pailgun.handle_request()
    except select.error:
      # SocketServer can throw `error: (9, 'Bad file descriptor')` on teardown. Ignore it.
      self._logger.warning('pailgun service shutting down')
Main service entrypoint. Called via Thread.start() via PantsDaemon.run().
dataset/ETHPy150Open pantsbuild/pants/src/python/pants/pantsd/service/pailgun_service.py/PailgunService.run