From 4efdc8b4f7a665ec08cb6463bb6dc9cfc42f7164 Mon Sep 17 00:00:00 2001 From: Paul Gauthier Date: Sat, 21 Dec 2024 11:09:52 -0800 Subject: [PATCH] refactor: Rename benchmark dir, improve rsync, fix problem stats --- benchmark/clone-exercism.sh | 4 ++-- benchmark/install-docker-ubuntu.sh | 10 ---------- benchmark/problem_stats.py | 14 ++++++++++---- benchmark/rsync.sh | 7 ++++++- 4 files changed, 18 insertions(+), 17 deletions(-) diff --git a/benchmark/clone-exercism.sh b/benchmark/clone-exercism.sh index bedb4eab0..a4dc79269 100755 --- a/benchmark/clone-exercism.sh +++ b/benchmark/clone-exercism.sh @@ -1,10 +1,10 @@ #!/bin/bash # Create directories if they don't exist -mkdir -p tmp.benchmark/exercism +mkdir -p tmp.benchmarks/exercism # Change to the exercism directory -cd tmp.benchmark/exercism +cd tmp.benchmarks/exercism # List of languages to clone languages=("cpp" "go" "java" "javascript" "python" "rust") diff --git a/benchmark/install-docker-ubuntu.sh b/benchmark/install-docker-ubuntu.sh index 3a56d3adf..3f163d8c1 100755 --- a/benchmark/install-docker-ubuntu.sh +++ b/benchmark/install-docker-ubuntu.sh @@ -49,11 +49,6 @@ fi # Print success message and instructions echo "Docker installation completed successfully!" -echo -e "\n*** IMPORTANT: Group changes require a complete session refresh." -echo "Please run these commands in sequence:" -echo "1. sudo systemctl restart docker" -echo "2. exit" -echo -e "Then log back in and docker commands should work without sudo\n" # Start Docker service echo "Starting Docker service..." @@ -66,8 +61,3 @@ docker --version echo "Docker Compose version:" docker compose version - -echo "Docker service status:" -sudo systemctl status docker --no-pager - -EOF diff --git a/benchmark/problem_stats.py b/benchmark/problem_stats.py index 31f4d3e72..eaace4046 100755 --- a/benchmark/problem_stats.py +++ b/benchmark/problem_stats.py @@ -23,9 +23,12 @@ def get_dirs_from_leaderboard(): def load_results(dirname): """Load all result files from a benchmark directory""" dirname = Path(dirname) - benchmark_dir = Path("tmp.benchmarks") / dirname + + benchmark_dir = dirname if not benchmark_dir.exists(): - return None + benchmark_dir = Path("tmp.benchmarks") / dirname + if not benchmark_dir.exists(): + return None all_results = [] parse_errors = [] # Track which exercises had parse errors for this model @@ -70,8 +73,11 @@ def analyze_exercise_solutions(dirs=None, topn=None, copy_hard_set=False): valid_entries = [] parse_errors_by_model = {} # Track which exercises had parse errors for each model + dump(dir_entries) + for dirname, model in dir_entries: results_data = load_results(dirname) + if results_data: results, model_parse_errors = results_data parse_errors_by_model[model] = set(model_parse_errors) @@ -299,7 +305,7 @@ def analyze_exercise_solutions(dirs=None, topn=None, copy_hard_set=False): if copy_hard_set: # Create hard set directory src_dir = Path("tmp.benchmarks/exercism") - dst_dir = Path("tmp.benchmarks/exercism-hard-set") + dst_dir = Path("tmp.benchmarks/exercism-polyglot") if dst_dir.exists(): print(f"\nError: Destination directory {dst_dir} already exists") @@ -340,7 +346,7 @@ if __name__ == "__main__": parser.add_argument( "--copy-hard-set", action="store_true", - help="Copy hard set problems to tmp.benchmarks/exercism-hard-set", + help="Copy hard set problems to tmp.benchmarks/exercism-polygot", ) args = parser.parse_args() diff --git a/benchmark/rsync.sh b/benchmark/rsync.sh index 9d8274ae2..8d1be20eb 100755 --- a/benchmark/rsync.sh +++ b/benchmark/rsync.sh @@ -1,5 +1,7 @@ #!/bin/bash +set -e + if [ $# -ne 1 ]; then echo "Usage: $0 user@host" exit 1 @@ -19,10 +21,13 @@ ssh "$DEST" "mkdir -p ~/aider" # Sync the repository rsync -avz --delete \ - --exclude='.git/' \ --exclude-from="$EXCLUDE_FILE" \ "$REPO_ROOT/" \ "$DEST:~/aider/" +rsync -a .env .bash_history .gitignore "$DEST:~/aider/." + +rsync -a ~/dotfiles/screenrc "$DEST:.screenrc" + # Clean up rm "$EXCLUDE_FILE"