Пример #1
0
def run_elastic_sync():
    logging.basicConfig(level=logging.INFO)
    logging.getLogger('aiohttp').setLevel(logging.WARNING)
    logging.getLogger('elasticsearch').setLevel(logging.WARNING)

    logging.info('lbry.server starting')
    parser = argparse.ArgumentParser(prog="lbry-hub-elastic-sync")
    parser.add_argument("-c", "--clients", type=int, default=32)
    parser.add_argument("-f", "--force", default=False, action='store_true')
    Env.contribute_to_arg_parser(parser)
    args = parser.parse_args()
    env = Env.from_arg_parser(args)

    if not os.path.exists(os.path.join(args.db_dir, 'lbry-leveldb')):
        logging.info("DB path doesnt exist, nothing to sync to ES")
        return

    asyncio.run(
        make_es_index_and_run_sync(env, clients=args.clients,
                                   force=args.force))
Пример #2
0
def get_argument_parser():
    parser = argparse.ArgumentParser(prog="lbry-hub")
    Env.contribute_to_arg_parser(parser)
    return parser