Island: Wrap mongo start in _initialize_mongodb_connection()
This commit is contained in:
parent
82c7782ff0
commit
61cb14d628
|
@ -52,11 +52,7 @@ def run_monkey_island():
|
||||||
_configure_logging(config_options)
|
_configure_logging(config_options)
|
||||||
container = _initialize_di_container(config_options.data_dir)
|
container = _initialize_di_container(config_options.data_dir)
|
||||||
|
|
||||||
mongo_db_process = None
|
_initialize_mongodb_connection(config_options.start_mongodb, config_options.data_dir)
|
||||||
if config_options.start_mongodb:
|
|
||||||
mongo_db_process = _start_mongodb(config_options.data_dir)
|
|
||||||
|
|
||||||
_connect_to_mongodb(mongo_db_process)
|
|
||||||
|
|
||||||
_configure_gevent_exception_handling(config_options.data_dir)
|
_configure_gevent_exception_handling(config_options.data_dir)
|
||||||
_start_island_server(island_args.setup_only, config_options, container)
|
_start_island_server(island_args.setup_only, config_options, container)
|
||||||
|
@ -95,6 +91,14 @@ def _initialize_di_container(data_dir: Path) -> DIContainer:
|
||||||
return initialize_services(data_dir)
|
return initialize_services(data_dir)
|
||||||
|
|
||||||
|
|
||||||
|
def _initialize_mongodb_connection(start_mongodb: bool, data_dir: Path):
|
||||||
|
mongo_db_process = None
|
||||||
|
if start_mongodb:
|
||||||
|
mongo_db_process = _start_mongodb(data_dir)
|
||||||
|
|
||||||
|
_connect_to_mongodb(mongo_db_process)
|
||||||
|
|
||||||
|
|
||||||
def _start_mongodb(data_dir: Path) -> MongoDbProcess:
|
def _start_mongodb(data_dir: Path) -> MongoDbProcess:
|
||||||
mongo_db_process = mongo_setup.start_mongodb(data_dir)
|
mongo_db_process = mongo_setup.start_mongodb(data_dir)
|
||||||
mongo_setup.register_mongo_shutdown_callback(mongo_db_process)
|
mongo_setup.register_mongo_shutdown_callback(mongo_db_process)
|
||||||
|
|
Loading…
Reference in New Issue