Ejemplo n.º 1
0
def main():
    persistence = persistence_backends.fetch({
        'connection': 'sqlite:////tmp/taskflow.db'

    })

    board = HypernodeJobBoard('my-board', {
        "hosts": "localhost",
    }, persistence=persistence)

    # board = job_backends.fetch("my-board", {
    #     "board": "zookeeper",
    #     "hosts": "localhost",
    #     "path": "/jobboard",
    # }, persistence=persistence)
    board.connect()

    # conductor = conductors.fetch("blocking", "executor 1", board, engine="parallel", wait_timeout=.1)
    conductor = AsyncConductor("async", board, engine="parallel")

    with contextlib.closing(board):
        conductor.run()
Ejemplo n.º 2
0
from board import HypernodeJobBoard

logging.basicConfig(level=logging.WARNING)

persistence = persistence_backends.fetch({
    "connection": "zookeeper",
    "hosts": "localhost",
    "path": "/taskflow",
})

# board = job_backends.fetch("my-board", {
#     "board": "zookeeper",
#     "hosts": "localhost",
# }, persistence=persistence)

board = HypernodeJobBoard('my-board', {
    "hosts": "localhost",
}, persistence=persistence)
board.connect()


with contextlib.closing(board):
    print("All jobs:")
    for job in board.iterjobs(ensure_fresh=True, only_unclaimed=False):
        print job

    print("Unclaimed:")
    for job in board.iterjobs(ensure_fresh=True, only_unclaimed=True):
        print job
Ejemplo n.º 3
0
        if lb.name == name:
            return lb

    return models.LogBook(name)


book = get_or_create_book(app_name)

flow_detail = models.FlowDetail("some flow (testflow)", uuid=uuidutils.generate_uuid())
book.add(flow_detail)

conn.save_logbook(book)

save_factory_details(flow_detail, flow_factory, (), {}, backend=persistence)


board = HypernodeJobBoard("my-board", {"hosts": "localhost"}, persistence=persistence)

# board = job_backends.fetch("my-board", {
#     "board": "zookeeper",
#     "hosts": "localhost",
# }, persistence=persistence)
board.connect()

with contextlib.closing(board):
    job = board.post(
        "my-first-job",
        book,
        details={"flow_uuid": flow_detail.uuid, "store": {"msg": "hoi", "app": app_name}, "app": app_name},
    )