code: def _install_signal_handlers(self):
          
          def request_stop(signum, frame):
              self._stop_requested = True
              self.log.info('stop requested, waiting for task to finish')
          signal.signal(signal.SIGINT, request_stop)
          signal.signal(signal.SIGTERM, request_stop)
docs: Sets up signal handlers for safely stopping the worker.