Exemplo n.º 1
0
def get_routes(ctx):
    log.debug('Requesting routes')

    log.debug("Creating logger")
    elog = elliptics.Logger(ctx.log_file, int(ctx.log_level))

    log.debug("Creating node")
    node = elliptics_create_node(address=ctx.address,
                                 elog=elog,
                                 wait_timeout=ctx.wait_timeout,
                                 remotes=ctx.remotes)

    log.debug("Creating session for: {0}".format(ctx.address))
    session = elliptics_create_session(node=node, group=0, trace_id=ctx.trace_id)

    log.debug("Parsing routing table")
    return RouteList.from_session(session)
Exemplo n.º 2
0
def get_routes(ctx):
    log.debug('Requesting routes')

    log.debug("Creating logger")
    elog = elliptics.Logger(ctx.log_file, int(ctx.log_level), True)

    log.debug("Creating node")
    node = elliptics_create_node(address=ctx.address,
                                 elog=elog,
                                 wait_timeout=ctx.wait_timeout,
                                 flags=elliptics.config_flags.no_route_list,
                                 remotes=ctx.remotes)

    log.debug("Creating session for: {0}".format(ctx.address))
    session = elliptics_create_session(node=node, group=0, trace_id=ctx.trace_id)

    log.debug("Parsing routing table")
    return session.routes.filter_by_groups(ctx.groups)
Exemplo n.º 3
0
def get_routes(ctx):
    log.debug('Requesting routes')

    log.debug("Creating logger")
    elog = elliptics.Logger(ctx.log_file, int(ctx.log_level))

    log.debug("Creating node")
    node = elliptics_create_node(address=ctx.address,
                                 elog=elog,
                                 wait_timeout=ctx.wait_timeout,
                                 remotes=ctx.remotes)

    log.debug("Creating session for: {0}".format(ctx.address))
    session = elliptics_create_session(node=node,
                                       group=0,
                                       trace_id=ctx.trace_id)

    log.debug("Parsing routing table")
    return RouteList.from_session(session)
Exemplo n.º 4
0
    log.debug("Using following context:\n{0}".format(ctx))

    log.debug("Setting up elliptics client")

    log.debug("Creating logger")
    elog = elliptics.Logger(ctx.log_file, int(ctx.log_level))

    log.debug("Creating node")
    node = elliptics_create_node(address=ctx.address,
                                 elog=elog,
                                 wait_timeout=ctx.wait_timeout,
                                 remotes=ctx.remotes)

    log.debug("Creating session for: {0}".format(ctx.address))
    session = elliptics_create_session(node=node, group=0)

    log.debug("Parsing routing table")
    ctx.routes = RouteList.from_session(session)
    log.debug("Parsed routing table:\n{0}".format(ctx.routes))
    if not ctx.routes:
        raise RuntimeError("No routes was parsed from session")
    log.debug("Total routes: {0}".format(len(ctx.routes)))

    if len(ctx.groups) == 0:
        ctx.groups = ctx.routes.groups()
        log.info("No groups specified: using all available groups: {0}".format(
            ctx.groups))

    try:
        log.info("Creating pool of processes: %d", ctx.nprocess)
Exemplo n.º 5
0
    log.debug("Using following context:\n{0}".format(ctx))

    log.debug("Setting up elliptics client")

    log.debug("Creating logger")
    elog = elliptics.Logger(ctx.log_file, int(ctx.log_level))

    log.debug("Creating node")
    node = elliptics_create_node(address=ctx.address,
                                 elog=elog,
                                 wait_timeout=ctx.wait_timeout,
                                 remotes=ctx.remotes)

    log.debug("Creating session for: {0}".format(ctx.address))
    session = elliptics_create_session(node=node, group=0)

    log.debug("Parsing routing table")
    ctx.routes = RouteList.from_session(session)
    log.debug("Parsed routing table:\n{0}".format(ctx.routes))
    if not ctx.routes:
        raise RuntimeError("No routes was parsed from session")
    log.debug("Total routes: {0}".format(len(ctx.routes)))

    if len(ctx.groups) == 0:
        ctx.groups = ctx.routes.groups()
        log.info("No groups specified: using all available groups: {0}".format(ctx.groups))

    try:
        log.info("Creating pool of processes: %d", ctx.nprocess)
        ctx.pool = Pool(processes=ctx.nprocess, initializer=worker_init)