def run(): """Run the proper routine as indicated by hive --mode argument.""" conf = Conf.init_argparse() Db.set_shared_instance(conf.db()) mode = conf.mode() if mode == 'server': from hive.server.serve import run_server run_server(conf=conf) elif mode == 'sync': from hive.indexer.sync import Sync Sync(conf=conf).run() elif mode == 'status': from hive.db.db_state import DbState print(DbState.status()) #elif mode == 'sync-profile': # from hive.indexer.sync import Sync # from hive.utils.profiler import Profiler # with Profiler(): # Sync(conf=conf).run() else: raise Exception("unknown run mode %s" % mode)
def run(): """Run the service specified in the `--mode` argument.""" conf = Conf.init_argparse() Db.set_shared_instance(conf.db()) mode = conf.mode() if conf.get('test_profile'): from hive.utils.profiler import Profiler with Profiler(): launch_mode(mode, conf) else: launch_mode(mode, conf)
def run(): """Run the proper routine as indicated by hive --mode argument.""" conf = Conf.init_argparse() Db.set_shared_instance(conf.db()) mode = '/'.join(conf.get('mode')) if mode == 'server': from hive.server.serve import run_server run_server(conf=conf) elif mode == 'sync': from hive.indexer.sync import Sync Sync(conf=conf).run() elif mode == 'status': from hive.db.db_state import DbState print(DbState.status()) else: raise Exception("unknown run mode %s" % mode)
"""Hive server and API tests.""" from hive.conf import Conf from hive.db.adapter import Db Db.set_shared_instance(Conf.init_test().db())