Skip to content

Commit

Permalink
Added --stats-only
Browse files Browse the repository at this point in the history
  • Loading branch information
paul-gauthier committed Jun 25, 2023
1 parent 5eaa50f commit c5a232e
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions scripts/benchmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def main():
action="store_true",
help="Verbose output",
)
parser.add_argument(
"--stats-only",
"-s",
action="store_true",
help="Do not run tests, just collect stats on completed tests",
)
parser.add_argument(
"--retries",
"-r",
Expand Down Expand Up @@ -109,10 +115,12 @@ def main():
args.retries,
args.no_test,
args.verbose,
args.stats_only,
)

all_results.append(results)
summarize_results(all_results, total_tests)
if not args.stats_only:
summarize_results(all_results, total_tests)
else:
run_test_threaded = lox.thread(args.threads)(run_test)
for testname in test_dnames:
Expand Down Expand Up @@ -177,7 +185,7 @@ def summarize_results(all_results, total_tests=None):
console.rule()


def run_test(testdir, model_name, edit_format, retries, no_test, verbose):
def run_test(testdir, model_name, edit_format, retries, no_test, verbose, stats_only):
dump(testdir)

if not os.path.isdir(testdir):
Expand All @@ -191,11 +199,15 @@ def run_test(testdir, model_name, edit_format, retries, no_test, verbose):
results_fname = testdir / ".aider.results.json"
if results_fname.exists():
try:
return json.loads(results_fname.read_text())
res = json.loads(results_fname.read_text())
return res
except JSONDecodeError:
print(f"{results_fname} failed to parse, skipping")
return

if stats_only:
return

fnames = []
for fname in testdir.glob("*"):
if "test" not in fname.name and fname.is_file() and fname.name[0] != ".":
Expand Down

0 comments on commit c5a232e

Please sign in to comment.