def __iter__(self):
        """
        Iterate on the socket and yield the received arguments. Exits if

        1. the flag .running is set to False
        2. SIGTERM is sent
        """
        # works with zmq.REP and zmq.PULL sockets
        self.running = True
        while self.running:
            try:
                if self.zsocket.poll(self.timeout):
                    args = self.zsocket.recv_pyobj()
                else:
                    # wait a bit more; print a warning for PULL sockets
                    if self.socket_type == 'PULL':
                        logging.warning('Timeout in %s', self)
                    continue
            except zmq.ZMQError:
                # sending SIGTERM raises ZMQError
                break
            yield args
def __iter__ ( self ) : self . running = True while self . running : try : if self . zsocket . poll ( self . timeout ) : args = self . zsocket . recv_pyobj ( ) else : if self . socket_type == 'PULL' : logging . warning ( 'Timeout in %s' , self ) continue except zmq . ZMQError : break yield args
Iterate on the socket and yield the received arguments. Exits if

        1. the flag .running is set to False
        2. SIGTERM is sent