From 121b456e31e7259cb3ea031952c134fe3fcc5786 Mon Sep 17 00:00:00 2001 From: Romazes Date: Mon, 23 Sep 2024 22:49:43 +0300 Subject: [PATCH] fix: change position of pull docker image --- lean/commands/backtest.py | 4 ++-- lean/commands/live/deploy.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lean/commands/backtest.py b/lean/commands/backtest.py index f8bd418c..01590400 100644 --- a/lean/commands/backtest.py +++ b/lean/commands/backtest.py @@ -365,6 +365,8 @@ def backtest(project: Path, project_config = project_config_manager.get_project_config(algorithm_file.parent) engine_image = cli_config_manager.get_engine_image(image or project_config.get("engine-image", None)) + container.update_manager.pull_docker_image_if_necessary(engine_image, update, no_update) + container_module_version = container.docker_manager.get_image_label(engine_image, CONTAINER_LABEL_LEAN_VERSION_NAME, None) @@ -380,8 +382,6 @@ def backtest(project: Path, if str(engine_image) != DEFAULT_ENGINE_IMAGE: logger.warn(f'A custom engine image: "{engine_image}" is being used!') - container.update_manager.pull_docker_image_if_necessary(engine_image, update, no_update) - if not output.exists(): output.mkdir(parents=True) diff --git a/lean/commands/live/deploy.py b/lean/commands/live/deploy.py index c81ebd40..46ca7d8a 100644 --- a/lean/commands/live/deploy.py +++ b/lean/commands/live/deploy.py @@ -277,6 +277,8 @@ def deploy(project: Path, project_config = project_config_manager.get_project_config(algorithm_file.parent) engine_image = cli_config_manager.get_engine_image(image or project_config.get("engine-image", None)) + container.update_manager.pull_docker_image_if_necessary(engine_image, update, no_update) + container_module_version = container.docker_manager.get_image_label(engine_image, CONTAINER_LABEL_LEAN_VERSION_NAME, None) @@ -291,8 +293,6 @@ def deploy(project: Path, raise MoreInfoError(f"The '{environment_name}' is not a live trading environment (live-mode is set to false)", "https://www.lean.io/docs/v2/lean-cli/live-trading/brokerages/quantconnect-paper-trading") - container.update_manager.pull_docker_image_if_necessary(engine_image, update, no_update) - _start_iqconnect_if_necessary(lean_config, environment_name) if python_venv is not None and python_venv != "":