Exemplo n.º 1
0
def worker():
    with connection() as c:
        b = Worker(QUEUE, c)
        b.storage.clear(force=True)
        yield b
        b.storage.clear(force=True)
        b.shutdown()
Exemplo n.º 2
0
def inmem_queue():
    with connection() as conn:
        e = Worker(queues="pytest", connection=conn)
        c = Queue(queue="pytest", connection=conn)
        c.e = e
        c.storage.clear(force=True)
        yield c
        e.shutdown()
Exemplo n.º 3
0
def initialize_workers():
    regular_worker = Worker(task_queue_name,
                            connection=connection,
                            num_workers=1)
    priority_worker = Worker(priority_queue_name,
                             connection=connection,
                             num_workers=3)
    return regular_worker, priority_worker
Exemplo n.º 4
0
def initialize_workers():
    logger.info("Starting scheduler workers.")
    regular_worker = Worker(task_queue_name,
                            connection=connection,
                            num_workers=1)
    priority_worker = Worker(priority_queue_name,
                             connection=connection,
                             num_workers=3)
    return regular_worker, priority_worker
Exemplo n.º 5
0
def worker():
    with tempfile.NamedTemporaryFile() as f:
        connection = create_engine(
            "sqlite:///{path}".format(path=f.name),
            connect_args={"check_same_thread": False},
            poolclass=NullPool,
        )
        b = Worker(QUEUE, connection)
        yield b
        b.shutdown()
Exemplo n.º 6
0
def inmem_queue():
    with tempfile.NamedTemporaryFile() as f:
        connection = create_engine(
            "sqlite:///{path}".format(path=f.name),
            connect_args={"check_same_thread": False},
            poolclass=NullPool,
        )
        e = Worker(queues="pytest", connection=connection)
        c = Queue(queue="pytest", connection=connection)
        c.e = e
        yield c
        e.shutdown()
Exemplo n.º 7
0
def worker():
    _, filepath = tempfile.mkstemp()
    connection = create_engine(
        "sqlite:///{path}".format(path=filepath),
        connect_args={"check_same_thread": False},
        poolclass=NullPool,
    )
    b = Worker(QUEUE, connection)
    yield b
    b.shutdown()
    try:
        os.remove(filepath)
    except OSError:
        pass
Exemplo n.º 8
0
def inmem_queue():
    fd, filepath = tempfile.mkstemp()
    connection = create_engine(
        "sqlite:///{path}".format(path=filepath),
        connect_args={"check_same_thread": False},
        poolclass=NullPool,
    )
    e = Worker(queues="pytest", connection=connection)
    c = Queue(queue="pytest", connection=connection)
    c.e = e
    yield c
    e.shutdown()
    os.close(fd)
    try:
        os.remove(filepath)
    except OSError:
        pass
Exemplo n.º 9
0
def initialize_worker():
    worker = Worker(app, connection=connection, num_workers=1)
    atexit.register(worker.shutdown)