def get(self, size=1, priority=0):
        """
        Get a bunch of objects from the message queue.
        This method will try to fetch objects from local node as much as wish.
        If not enough, will try to fetch from the other nodes.

        :param size: the objects wish to fetch
        :param priority: the priority queue which wants to fetch from
        :return: the objects which to handle
        """
        self.init()
        
        if size < 1: size = 1
        results = []
        _addrs = sorted(self.addrs, key=lambda k: k==self.addr_, 
                             reverse=True)
        
        for addr in _addrs:
            left = size - len(results)
            if left <= 0:
                break
            
            objs = None
            try:
                objs = self._remote_or_local_get(addr, size=left, 
                                                 priority=priority)
            except socket.error, e:
                if self.logger:
                    self.logger.exception(e)
                    
            if objs is None:
                continue
            if not isinstance(objs, list):
                objs = [objs, ]
            results.extend(objs)
        
        if size == 1:
            if len(results) == 0:
                return
            return results[0]
        return results
dataset/ETHPy150Open chineking/cola/cola/core/mq/node.py/MessageQueueNodeProxy.get/original