From 7bc5ed6d557aad68994bcaf10cd380fe0e858a08 Mon Sep 17 00:00:00 2001 From: jacobogle Date: Sat, 13 Apr 2024 09:32:38 -0400 Subject: [PATCH] Minor: benchmarks handle python pip installs for user --- benchmarks/.gitignore | 3 ++- benchmarks/bench.sh | 6 +++++- benchmarks/compare.py | 10 ++-------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/benchmarks/.gitignore b/benchmarks/.gitignore index 2c574ff30d121..a45786d790034 100644 --- a/benchmarks/.gitignore +++ b/benchmarks/.gitignore @@ -1,2 +1,3 @@ data -results \ No newline at end of file +results +.venv \ No newline at end of file diff --git a/benchmarks/bench.sh b/benchmarks/bench.sh index a72400892752e..31df84d8ab73e 100755 --- a/benchmarks/bench.sh +++ b/benchmarks/bench.sh @@ -440,6 +440,9 @@ compare_benchmarks() { fi echo "Comparing ${BRANCH1} and ${BRANCH2}" + python3 -m venv ./${SCRIPT_DIR}/venv + source ./${SCRIPT_DIR}/venv/bin/activate + pip3 install rich for bench in `ls ${BASE_RESULTS_DIR}/${BRANCH1}` ; do RESULTS_FILE1="${BASE_RESULTS_DIR}/${BRANCH1}/${bench}" RESULTS_FILE2="${BASE_RESULTS_DIR}/${BRANCH2}/${bench}" @@ -448,11 +451,12 @@ compare_benchmarks() { echo "Benchmark ${bench}" echo "--------------------" python3 "${SCRIPT_DIR}"/compare.py "${RESULTS_FILE1}" "${RESULTS_FILE2}" + else echo "Note: Skipping ${RESULTS_FILE1} as ${RESULTS_FILE2} does not exist" fi done - + rm -r ./${SCRIPT_DIR}/venv } # And start the process up diff --git a/benchmarks/compare.py b/benchmarks/compare.py index ec2b28fa0556c..75e04d5addb22 100755 --- a/benchmarks/compare.py +++ b/benchmarks/compare.py @@ -24,14 +24,8 @@ from typing import Dict, List, Any from pathlib import Path from argparse import ArgumentParser - -try: - from rich.console import Console - from rich.table import Table -except ImportError: - print("Try `pip install rich` for using this script.") - raise - +from rich.console import Console +from rich.table import Table @dataclass class QueryResult: