Skip to content
This repository has been archived by the owner on Feb 20, 2023. It is now read-only.

Nightly Microbenchmark JSON Fixes #1543

Merged
merged 2 commits into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions script/testing/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Benchmark script output
*.json
*.xml
15 changes: 10 additions & 5 deletions script/testing/microbench/micro_benchmarks_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import os
import shutil
import subprocess
import re

from ..util.constants import LOG
from .constants import LOCAL_REPO_DIR
Expand Down Expand Up @@ -41,7 +42,7 @@ def run_benchmarks(self, enable_perf):

# iterate over all benchmarks and run them
for benchmark_count, bench_name in enumerate(self.config.benchmarks):
LOG.info(f"Running '{bench_name}' with {self.config.num_threads} threads [{benchmark_count}/{len(self.config.benchmarks)}]")
LOG.info(f"Running '{bench_name}' with {self.config.num_threads} threads [{benchmark_count+1}/{len(self.config.benchmarks)}]")
benchmark_ret_val = self.run_single_benchmark(bench_name, enable_perf)
if benchmark_ret_val:
ret_val = benchmark_ret_val
Expand Down Expand Up @@ -72,8 +73,8 @@ def run_single_benchmark(self, bench_name, enable_perf):
cmd = self._build_benchmark_cmd(bench_name, output_file, enable_perf)

# Environment Variables
os.environ["TERRIER_BENCHMARK_THREADS"] = str(self.config.num_threads) # has to be a str
os.environ["TERRIER_BENCHMARK_LOGFILE_PATH"] = self.config.logfile_path
os.environ["NOISEPAGE_BENCHMARK_THREADS"] = str(self.config.num_threads) # has to be a str
os.environ["NOISEPAGE_BENCHMARK_LOGFILE_PATH"] = self.config.logfile_path

ret_val, err = self._execute_benchmark(cmd)

Expand Down Expand Up @@ -142,7 +143,11 @@ def _execute_benchmark(self, cmd):
LOG.debug(f'Executing command [num_threads={self.config.num_threads}]: {cmd}')
try:
output = subprocess.check_output(cmd, stderr=subprocess.STDOUT, shell=True)
pretty_format_json = json.dumps(json.loads(output.decode('utf8').replace("'", '"')), indent=4)

# Strip DBMS debug messages
output = re.sub(r"\[.*?\] \[.*?\] \[[\w]+\] .*\n", "", output.decode('utf8'))
lmwnshn marked this conversation as resolved.
Show resolved Hide resolved

pretty_format_json = json.dumps(json.loads(output.replace("'", '"')), indent=4)
LOG.debug(f'OUTPUT: {pretty_format_json}')
return 0, None
except subprocess.CalledProcessError as err:
Expand Down Expand Up @@ -260,4 +265,4 @@ def copy_benchmark_result(bench_name, build_dir):
"""
result_file = f'{bench_name}.json'
shutil.copy(result_file, build_dir)
LOG.debug(f'Copything result file {result_file} into {build_dir}')
LOG.debug(f'Copying result file {result_file} into {build_dir}')