memsql/common/sql_step_queue/queue.py
def start(self, block=False, timeout=None, retry_interval=0.5, extra_predicate=None):
        """
        Retrieve a task handler from the queue.

        If block is True, this function will block until it is able to retrieve a task.
        If block is True and timeout is a number it will block for at most <timeout> seconds.
        retry_interval is the maximum time in seconds between successive retries.

        extra_predicate
        If extra_predicate is defined, it should be a tuple of (raw_predicate, predicate_args)
        raw_predicate will be prefixed by AND, and inserted into the WHERE condition in the queries.
        predicate_args will be sql escaped and formatted into raw_predicate.
        """
        start = time.time()
        while 1:
            task_handler = self._dequeue_task(extra_predicate)
            if task_handler is None and block:
                if timeout is not None and (time.time() - start) > timeout:
                    break
                time.sleep(retry_interval * (random.random() + 0.1))
            else:
                break
        return task_handler
def start(self, block=False, timeout=None, retry_interval=0.5, extra_predicate=None):
        start = time.time()
        while 1:
            task_handler = self._dequeue_task(extra_predicate)
            if task_handler is None and block:
                if timeout is not None and (time.time() - start) > timeout:
                    break
                time.sleep(retry_interval * (random.random() + 0.1))
            else:
                break
        return task_handler
def start ( self , block = False , timeout = None , retry_interval = 0.5 , extra_predicate = None ) : start = time . time ( ) while 1 : task_handler = self . _dequeue_task ( extra_predicate ) if task_handler is None and block : if timeout is not None and ( time . time ( ) - start ) > timeout : break time . sleep ( retry_interval * ( random . random ( ) + 0.1 ) ) else : break return task_handler
Retrieve a task handler from the queue.

        If block is True, this function will block until it is able to retrieve a task.
        If block is True and timeout is a number it will block for at most <timeout> seconds.
        retry_interval is the maximum time in seconds between successive retries.

        extra_predicate
        If extra_predicate is defined, it should be a tuple of (raw_predicate, predicate_args)
        raw_predicate will be prefixed by AND, and inserted into the WHERE condition in the queries.
        predicate_args will be sql escaped and formatted into raw_predicate.
Retrieve a task handler from the queue .