code: def _run_producer_wrapper(self):
          '''Run the producer, if exception, stop engine.'''
          try:
              yield from self._producer.process()
          except Exception as error:
              if not isinstance(error, StopIteration):
                  # Stop the workers so the producer exception will be handled
                  # when we finally yield from this coroutine
                  _logger.debug('Producer died.', exc_info=True)
                  self.stop()
              raise
          else:
              self.stop(f _run_producer_wrapper(self):
          '''Run the producer, if exception, stop engine.'''
          try:
              yield from self._producer.process()
          except Exception as error:
              if not isinstance(error, StopIteration):
                  # Stop the workers so the producer exception will be handled
                  # when we finally yield from this coroutine
                  _logger.debug('Producer died.', exc_info=True)
                  self.stop()
              raise
          else:
              self.stop()
docs: Run the producer, if exception, stop engine.