diff --git a/esrally/mechanic/team.py b/esrally/mechanic/team.py index f0f2b5d23..e12af2400 100644 --- a/esrally/mechanic/team.py +++ b/esrally/mechanic/team.py @@ -19,8 +19,8 @@ import logging import os from enum import Enum -from typing import Any, Collection, Mapping, Union from types import ModuleType +from typing import Any, Collection, Mapping, Union import tabulate @@ -49,7 +49,7 @@ def list_cars(cfg: types.Config): console.println(tabulate.tabulate([[c.name, c.type, c.description] for c in cars], headers=["Name", "Type", "Description"])) -def load_car(repo: str, name: Collection[str], car_params: Mapping=None) -> "Car": +def load_car(repo: str, name: Collection[str], car_params: Mapping = None) -> "Car": class Component: def __init__(self, root_path, entry_point): self.root_path = root_path @@ -240,7 +240,7 @@ class Car: def __init__( self, names: Collection[str], - root_path: Union[str, Collection[str]], + root_path: Union[None, str, Collection[str]], config_paths: Collection[str], variables: Mapping[str, Any] = None, ): @@ -259,7 +259,9 @@ def __init__( else: self.names = names - if isinstance(root_path, str): + if root_path is None: + self.root_path = [] + elif isinstance(root_path, str): self.root_path = [root_path] else: self.root_path = root_path diff --git a/esrally/utils/modules.py b/esrally/utils/modules.py index 555663954..b0396becb 100644 --- a/esrally/utils/modules.py +++ b/esrally/utils/modules.py @@ -19,8 +19,8 @@ import logging import os import sys -from typing import Collection, Union from types import ModuleType +from typing import Collection, Union from esrally import exceptions from esrally.utils import io @@ -65,7 +65,7 @@ def _load_component(self, component_name: str, module_dirs: Collection[str], roo # precondition: A module with this name has to exist provided that the caller has called #can_load() before. root_module_name = "%s.%s" % (component_name, self.component_entry_point) for name, p in self._modules(module_dirs, component_name, root_path): - self.logger.debug(f"Loading module [{name}]: {p}") + self.logger.debug("Loading module [%s]: %s", name, p) spec = importlib.util.spec_from_file_location(name, p) m = importlib.util.module_from_spec(spec) spec.loader.exec_module(m) @@ -118,6 +118,5 @@ def load(self) -> Collection[ModuleType]: except BaseException: msg = f"Could not load component [{component_name}]" self.logger.exception(msg) - raise - # raise exceptions.SystemSetupError(msg) + raise exceptions.SystemSetupError(msg) return root_modules diff --git a/esrally/utils/process.py b/esrally/utils/process.py index 597a31a51..ab28ec63e 100644 --- a/esrally/utils/process.py +++ b/esrally/utils/process.py @@ -142,7 +142,6 @@ def run_subprocess_with_logging_and_output( if header is not None: logger.info(header) - # pylint: disable=subprocess-popen-preexec-fn completed = subprocess.run( command_line_args, stdout=subprocess.PIPE, diff --git a/tests/mechanic/provisioner_test.py b/tests/mechanic/provisioner_test.py index d4a8ac982..fe6aeae4b 100644 --- a/tests/mechanic/provisioner_test.py +++ b/tests/mechanic/provisioner_test.py @@ -42,7 +42,7 @@ def null_apply_config(source_root_path, target_root_path, config_vars): installer = provisioner.ElasticsearchInstaller( car=team.Car( names="unit-test-car", - root_path=None, # type: ignore + root_path=None, config_paths=[HOME_DIR + "/.rally/benchmarks/teams/default/my-car"], variables={ "heap": "4g",