def push_results(self, kill_event):
        """ Listens on the pending_result_queue and sends out results via 0mq

        Parameters:
        -----------
        kill_event : threading.Event
              Event to let the thread know when it is time to die.
        """

        logger.debug("[RESULT_PUSH_THREAD] Starting thread")

        push_poll_period = max(10, self.poll_period) / 1000    # push_poll_period must be atleast 10 ms
        logger.debug("[RESULT_PUSH_THREAD] push poll period: {}".format(push_poll_period))

        last_beat = time.time()
        items = []

        while not kill_event.is_set():

            try:
                r = self.pending_result_queue.get(block=True, timeout=push_poll_period)
                items.append(r)
            except queue.Empty:
                pass
            except Exception as e:
                logger.exception("[RESULT_PUSH_THREAD] Got an exception: {}".format(e))

            # If we have reached poll_period duration or timer has expired, we send results
            if len(items) >= self.max_queue_size or time.time() > last_beat + push_poll_period:
                last_beat = time.time()
                if items:
                    self.result_outgoing.send_multipart(items)
                    items = []

        logger.critical("[RESULT_PUSH_THREAD] Exiting")
def push_results(self, kill_event):
        """ Listens on the pending_result_queue and sends out results via 0mq

        Parameters:
        -----------
        kill_event : threading.Event
              Event to let the thread know when it is time to die.
        """

        logger.debug("[RESULT_PUSH_THREAD] Starting thread")

        push_poll_period = max(10, self.poll_period) / 1000    # push_poll_period must be atleast 10 ms
        logger.debug("[RESULT_PUSH_THREAD] push poll period: {}".format(push_poll_period))

        last_beat = time.time()
        items = []

        while not kill_event.is_set():

            try:
                r = self.pending_result_queue.get(block=True, timeout=push_poll_period)
                items.append(r)
            except queue.Empty:
                pass
            except Exception as e:
                logger.exception("[RESULT_PUSH_THREAD] Got an exception: {}".format(e))

            # If we have reached poll_period duration or timer has expired, we send results
            if len(items) >= self.max_queue_size or time.time() > last_beat + push_poll_period:
                last_beat = time.time()
                if items:
                    self.result_outgoing.send_multipart(items)
                    items = []

        logger.critical("[RESULT_PUSH_THREAD] Exiting")
def push_results ( self , kill_event ) : logger . debug ( "[RESULT_PUSH_THREAD] Starting thread" ) push_poll_period = max ( 10 , self . poll_period ) / 1000 # push_poll_period must be atleast 10 ms logger . debug ( "[RESULT_PUSH_THREAD] push poll period: {}" . format ( push_poll_period ) ) last_beat = time . time ( ) items = [ ] while not kill_event . is_set ( ) : try : r = self . pending_result_queue . get ( block = True , timeout = push_poll_period ) items . append ( r ) except queue . Empty : pass except Exception as e : logger . exception ( "[RESULT_PUSH_THREAD] Got an exception: {}" . format ( e ) ) # If we have reached poll_period duration or timer has expired, we send results if len ( items ) >= self . max_queue_size or time . time ( ) > last_beat + push_poll_period : last_beat = time . time ( ) if items : self . result_outgoing . send_multipart ( items ) items = [ ] logger . critical ( "[RESULT_PUSH_THREAD] Exiting" )
Listens on the pending_result_queue and sends out results via 0mq

        Parameters:
        -----------
        kill_event : threading.Event
              Event to let the thread know when it is time to die.
Listens on the pending_result_queue and sends out results via 0mq