def worker(): with connection() as c: b = Worker(QUEUE, c) b.storage.clear(force=True) yield b b.storage.clear(force=True) b.shutdown()
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()
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
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
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()
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()
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
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
def initialize_worker(): worker = Worker(app, connection=connection, num_workers=1) atexit.register(worker.shutdown)