Exemple #1
0
def get_next_task(context, task_limit):
    counter = count()
    queue = context.task_queue

    while context.alive and not task_limit_reached(counter, task_limit):
        task = queue.get()

        if task is not None and not task.cancelled:
            yield task
        else:
            queue.task_done()
Exemple #2
0
def worker_get_next_task(channel, task_limit):
    counter = count()

    while not task_limit_reached(counter, task_limit):
        yield fetch_task(channel)