From f53ebaf088a8cecf80f1488e7d5c59856e878b0a Mon Sep 17 00:00:00 2001 From: Peter Josef Scheibel Date: Fri, 8 Mar 2024 14:57:21 -0800 Subject: [PATCH] check out pinned spack/ramble versions --- bin/benchpark | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/bin/benchpark b/bin/benchpark index 395ae0a4e..5f818bef9 100755 --- a/bin/benchpark +++ b/bin/benchpark @@ -6,12 +6,14 @@ # SPDX-License-Identifier: Apache-2.0 import argparse +from contextlib import contextmanager import os import pathlib import shlex import shutil import subprocess import sys +import yaml DEBUG = False @@ -202,6 +204,27 @@ def symlink_tree(src, dst): os.symlink(src_file, dst_symlink) +@contextmanager +def working_dir(location): + initial_dir = os.getcwd() + try: + os.chdir(location) + yield + finally: + os.chdir(initial_dir) + + +def git_clone_commit(url, commit, destination): + run_command( + "git clone -c feature.manyFiles=true " + f"{url} " + f"{destination}" + ) + + with working_dir(destination): + run_command(f"git checkout {commit}") + + def benchpark_setup_handler(args): """ experiments_root/ @@ -269,12 +292,16 @@ def benchpark_setup_handler(args): initializer_script = experiments_root / "setup.sh" + checkout_versions_location = source_dir / "checkout-versions.yaml" + with open(checkout_versions_location, "r") as yaml_file: + data = yaml.safe_load(yaml_file) + ramble_commit = data["versions"]["ramble"] + spack_commit = data["versions"]["spack"] + if not spack_location.exists(): print(f"Cloning spack into {spack_location}") - run_command( - "git clone --depth=1 -c feature.manyFiles=true " - "https://github.com/spack/spack.git " - f"{spack_location}" + git_clone_commit( + "https://github.com/spack/spack.git", spack_commit, spack_location ) env = {"SPACK_DISABLE_LOCAL_CONFIG": "1"} @@ -286,10 +313,8 @@ def benchpark_setup_handler(args): if not ramble_location.exists(): print(f"Cloning ramble into {ramble_location}") - run_command( - "git clone --depth=1 -c feature.manyFiles=true " - "https://github.com/GoogleCloudPlatform/ramble.git " - f"{ramble_location}" + git_clone_commit( + "https://github.com/GoogleCloudPlatform/ramble.git", ramble_commit, ramble_location ) run_command(f"{ramble_exe} repo add --scope=site {source_dir}/repo")