zeronimo/core.py
def establish(self, call_id, timeout, limit=None,
                  retry=None, max_retries=None):
        """Waits for the call is accepted by workers and starts to collect the
        results.
        """
        rejected = 0
        retried = 0
        results = []
        result_queue = self.result_queues[call_id]
        try:
            with Timeout(timeout, False):
                while True:
                    result = result_queue.get()
                    if result is None:
                        rejected += 1
                        if retry is not None:
                            if retried == max_retries:
                                break
                            retry()
                            retried += 1
                        continue
                    results.append(result)
                    if len(results) == limit:
                        break
        finally:
            del result_queue
            self.remove_result_queue(call_id)
        if not results:
            if rejected:
                raise Rejected('%d workers rejected' % rejected
                               if rejected != 1 else
                               'A worker rejected')
            else:
                raise WorkerNotFound('failed to find worker')
        return results
def establish(self, call_id, timeout, limit=None,
                  retry=None, max_retries=None):
        rejected = 0
        retried = 0
        results = []
        result_queue = self.result_queues[call_id]
        try:
            with Timeout(timeout, False):
                while True:
                    result = result_queue.get()
                    if result is None:
                        rejected += 1
                        if retry is not None:
                            if retried == max_retries:
                                break
                            retry()
                            retried += 1
                        continue
                    results.append(result)
                    if len(results) == limit:
                        break
        finally:
            del result_queue
            self.remove_result_queue(call_id)
        if not results:
            if rejected:
                raise Rejected('%d workers rejected' % rejected
                               if rejected != 1 else
                               'A worker rejected')
            else:
                raise WorkerNotFound('failed to find worker')
        return results
def establish ( self , call_id , timeout , limit = None , retry = None , max_retries = None ) : rejected = 0 retried = 0 results = [ ] result_queue = self . result_queues [ call_id ] try : with Timeout ( timeout , False ) : while True : result = result_queue . get ( ) if result is None : rejected += 1 if retry is not None : if retried == max_retries : break retry ( ) retried += 1 continue results . append ( result ) if len ( results ) == limit : break finally : del result_queue self . remove_result_queue ( call_id ) if not results : if rejected : raise Rejected ( '%d workers rejected' % rejected if rejected != 1 else 'A worker rejected' ) else : raise WorkerNotFound ( 'failed to find worker' ) return results
Waits for the call is accepted by workers and starts to collect the
        results.
Waits for the call is accepted by workers and starts to collect the results .