コード例 #1
0
async def startup_event():
    logger.info(
        "configuration dump",
        dumped_config=config.dump_yaml(),
        version=mlrun.utils.version.Version().get(),
    )
    loop = asyncio.get_running_loop()
    # Using python 3.8 default instead of 3.7 one - max(1, os.cpu_count()) * 5 cause it's causing to high memory
    # consumption - https://bugs.python.org/issue35279
    # TODO: remove when moving to python 3.8
    max_workers = config.httpdb.max_workers or min(32, os.cpu_count() + 4)
    loop.set_default_executor(
        concurrent.futures.ThreadPoolExecutor(max_workers=max_workers))

    initialize_logs_dir()
    initialize_db()

    if config.httpdb.state == mlrun.api.schemas.APIStates.online:
        await move_api_to_online()
コード例 #2
0
async def _initialize_singletons():
    initialize_logs_dir()
    initialize_db()
    initialize_project_member()
    await initialize_scheduler()