diff --git a/sebs.py b/sebs.py index fcb54087..4eaa883b 100755 --- a/sebs.py +++ b/sebs.py @@ -447,6 +447,12 @@ def local(): default=True, help="Remove containers after stopping.", ) +@click.option( + "--architecture", + default="x64", + type=click.Choice(["x64", "arm64"]), + help="Target architecture", +) @simplified_common_params def start( benchmark, @@ -456,6 +462,7 @@ def start( storage_configuration, measure_interval, remove_containers, + architecture, **kwargs, ): """ @@ -464,7 +471,8 @@ def start( (config, output_dir, logging_filename, sebs_client, deployment_client) = parse_common_params( update_code=False, update_storage=False, - deployment="local", storage_configuration=storage_configuration, **kwargs + deployment="local", storage_configuration=storage_configuration, + architecture=architecture, container_deployment=False, ignore_cache=False, **kwargs ) deployment_client = cast(sebs.local.Local, deployment_client) deployment_client.remove_containers = remove_containers diff --git a/sebs/cache.py b/sebs/cache.py index e5a6744f..51e74bd8 100644 --- a/sebs/cache.py +++ b/sebs/cache.py @@ -169,14 +169,19 @@ def get_storage_config(self, deployment: str, benchmark: str): return cfg["storage"] if cfg and "storage" in cfg and not self.ignore_storage else None def update_storage(self, deployment: str, benchmark: str, config: dict): - if self.ignore_storage: - return benchmark_dir = os.path.join(self.cache_dir, benchmark) + config_path = os.path.join(benchmark_dir, "config.json") + + if self.ignore_storage or not os.path.exists(config_path): + self.logging.debug( + f"Skipping storage update: ignore_storage={self.ignore_storage}, config exists={os.path.exists(config_path)} at {config_path}" + ) + return with self._lock: - with open(os.path.join(benchmark_dir, "config.json"), "r") as fp: + with open(config_path, "r") as fp: cached_config = json.load(fp) cached_config[deployment]["storage"] = config - with open(os.path.join(benchmark_dir, "config.json"), "w") as fp: + with open(config_path, "w") as fp: json.dump(cached_config, fp, indent=2) def add_code_package( diff --git a/sebs/config.py b/sebs/config.py index 3a34ebb8..cb49f613 100644 --- a/sebs/config.py +++ b/sebs/config.py @@ -37,9 +37,12 @@ def docker_image_types(self, deployment_name: str, language_name: str) -> List[s def supported_language_versions( self, deployment_name: str, language_name: str, architecture: str ) -> List[str]: - return self._system_config[deployment_name]["languages"][language_name]["base_images"][ - architecture - ].keys() + languages = self._system_config.get(deployment_name, {}).get("languages", {}) + base_images = languages.get(language_name, {}).get("base_images", {}) + + if deployment_name == "local": + return list(base_images.keys()) + return list(base_images.get(architecture, {}).keys()) def supported_architecture(self, deployment_name: str) -> List[str]: return self._system_config[deployment_name]["architecture"]