def _ReceiveItemOnActivity(self, zmq_socket):
    """Attempts to receive an item from a ZeroMQ socket.

    Args:
      zmq_socket (zmq.Socket): used to the receive the item.

    Returns:
      object: item from the socket.

    Raises:
      QueueEmpty: if no item could be received within the timeout.
      zmq.error.ZMQError: if an error occurs in ZeroMQ
    """
    events = zmq_socket.poll(
        self._ZMQ_SOCKET_RECEIVE_TIMEOUT_MILLISECONDS)
    if events:
      try:
        received_object = self._zmq_socket.recv_pyobj()
        return received_object

      except zmq.error.Again:
        logger.error(
            '{0:s}. Failed to receive item in time.'.format(
                self.name))
        raise

      except zmq.error.ZMQError as exception:
        if exception.errno == errno.EINTR:
          logger.error(
              'ZMQ syscall interrupted in {0:s}. Queue aborting.'.format(
                  self.name))
        raise

    raise errors.QueueEmpty
def _ReceiveItemOnActivity ( self , zmq_socket ) : events = zmq_socket . poll ( self . _ZMQ_SOCKET_RECEIVE_TIMEOUT_MILLISECONDS ) if events : try : received_object = self . _zmq_socket . recv_pyobj ( ) return received_object except zmq . error . Again : logger . error ( '{0:s}. Failed to receive item in time.' . format ( self . name ) ) raise except zmq . error . ZMQError as exception : if exception . errno == errno . EINTR : logger . error ( 'ZMQ syscall interrupted in {0:s}. Queue aborting.' . format ( self . name ) ) raise raise errors . QueueEmpty
Attempts to receive an item from a ZeroMQ socket.

    Args:
      zmq_socket (zmq.Socket): used to the receive the item.

    Returns:
      object: item from the socket.

    Raises:
      QueueEmpty: if no item could be received within the timeout.
      zmq.error.ZMQError: if an error occurs in ZeroMQ