code: 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._state.is_terminating:
          self.pailgun.handle_request()
          self._state.maybe_pause()
      except select.error as e:
        # SocketServer can throw `error: (9, 'Bad file descriptor')` on teardown. Ignore it.
        self._logger.warning('pailgun service shutting down due to an error: {}'.format(e))
      finally:
        self._logger.info('pailgun service on port {} shutting down'.format(self.pailgun_port))
docs: Main service entrypoint. Called via Thread.start() via PantsDaemon.run().