Skip to content

Commit

Permalink
Pin spack and ramble (#164)
Browse files Browse the repository at this point in the history
* add versioning file

* check out pinned spack/ramble versions

* style fix
  • Loading branch information
scheibelp authored Mar 9, 2024
1 parent 5fcf954 commit 45a262b
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 8 deletions.
39 changes: 31 additions & 8 deletions bin/benchpark
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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/
Expand Down Expand Up @@ -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"}
Expand All @@ -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")
Expand Down
8 changes: 8 additions & 0 deletions checkout-versions.yaml
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 45a262b

Please sign in to comment.