From 45a262bc1032752207ca07e9129a99b690dfbc8e Mon Sep 17 00:00:00 2001 From: Peter Scheibel Date: Fri, 8 Mar 2024 19:59:37 -0800 Subject: [PATCH] Pin spack and ramble (#164) * add versioning file * check out pinned spack/ramble versions * style fix --- bin/benchpark | 39 +++++++++++++++++++++++++++++++-------- checkout-versions.yaml | 8 ++++++++ 2 files changed, 39 insertions(+), 8 deletions(-) create mode 100644 checkout-versions.yaml diff --git a/bin/benchpark b/bin/benchpark index 395ae0a4..ba30bbd0 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,23 @@ 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(f"git clone -c feature.manyFiles=true {url} {destination}") + + with working_dir(destination): + run_command(f"git checkout {commit}") + + def benchpark_setup_handler(args): """ experiments_root/ @@ -269,12 +288,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 +309,10 @@ 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") diff --git a/checkout-versions.yaml b/checkout-versions.yaml new file mode 100644 index 00000000..828ea103 --- /dev/null +++ b/checkout-versions.yaml @@ -0,0 +1,8 @@ +# Copyright 2023 Lawrence Livermore National Security, LLC and other +# Benchpark Project Developers. See the top-level COPYRIGHT file for details. +# +# SPDX-License-Identifier: Apache-2.0 + +versions: + ramble: 3d6d2670435c704ca815ae13abe49b10c5111638 + spack: 31de670bd26beca979ebd75dcb0ce90c535a78c4