From 3b3d0cc3779ae4d7eeea5e8dcc3c534230fcc37a Mon Sep 17 00:00:00 2001 From: Roman Yavnikov <45608740+Romazes@users.noreply.github.com> Date: Mon, 9 Sep 2024 20:01:37 +0300 Subject: [PATCH] Fix: missed installing extra modules (#499) * fix: missed module installing for extra packages feat: module_version for extra packages * feat:comment: why it must not be removed --- lean/commands/backtest.py | 2 +- lean/commands/live/deploy.py | 2 +- lean/commands/optimize.py | 2 +- lean/components/util/json_modules_handler.py | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/lean/commands/backtest.py b/lean/commands/backtest.py index 779b07fd..f8bd418c 100644 --- a/lean/commands/backtest.py +++ b/lean/commands/backtest.py @@ -405,7 +405,7 @@ def backtest(project: Path, # Configure addon modules build_and_configure_modules(addon_module, cli_addon_modules, organization_id, lean_config, - kwargs, logger, environment_name) + kwargs, logger, environment_name, container_module_version) lean_runner = container.lean_runner lean_runner.run_lean(lean_config, diff --git a/lean/commands/live/deploy.py b/lean/commands/live/deploy.py index ad600fae..c81ebd40 100644 --- a/lean/commands/live/deploy.py +++ b/lean/commands/live/deploy.py @@ -352,7 +352,7 @@ def deploy(project: Path, # Configure addon modules build_and_configure_modules(addon_module, cli_addon_modules, organization_id, lean_config, - kwargs, logger, environment_name) + kwargs, logger, environment_name, container_module_version) if container.platform_manager.is_host_arm(): if "InteractiveBrokersBrokerage" in lean_config["environments"][environment_name]["live-mode-brokerage"] \ diff --git a/lean/commands/optimize.py b/lean/commands/optimize.py index cd361121..67dd08b1 100644 --- a/lean/commands/optimize.py +++ b/lean/commands/optimize.py @@ -340,7 +340,7 @@ def optimize(project: Path, # Configure addon modules build_and_configure_modules(addon_module, cli_addon_modules, organization_id, lean_config, - kwargs, logger, environment_name) + kwargs, logger, environment_name, container_module_version) container.update_manager.pull_docker_image_if_necessary(engine_image, update, no_update) diff --git a/lean/components/util/json_modules_handler.py b/lean/components/util/json_modules_handler.py index bf449cd2..5b59ba47 100644 --- a/lean/components/util/json_modules_handler.py +++ b/lean/components/util/json_modules_handler.py @@ -19,7 +19,7 @@ def build_and_configure_modules(target_modules: List[str], module_list: List[JsonModule], organization_id: str, lean_config: Dict[str, Any], properties: Dict[str, Any], logger: Logger, - environment_name: str): + environment_name: str, module_version: str): """Builds and configures the given modules :param target_modules: the requested modules @@ -29,10 +29,13 @@ def build_and_configure_modules(target_modules: List[str], module_list: List[Jso :param properties: the user provided arguments :param logger: the logger instance :param environment_name: the environment name to use + :param module_version: The version of the module to install. If not provided, the latest version will be installed. """ for target_module_name in target_modules: module = non_interactive_config_build_for_name(lean_config, target_module_name, module_list, properties, logger, environment_name) + # Ensures extra modules (not brokerage or data feeds) are installed. + module.ensure_module_installed(organization_id, module_version) lean_config["environments"][environment_name].update(module.get_settings())