Skip to content
This repository was archived by the owner on Jan 7, 2025. It is now read-only.

Commit

Permalink
try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
jakethekoenig committed Jan 16, 2024
1 parent 602b718 commit 2b63cb4
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions benchmarks/benchmark_runner.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,23 @@ async def evaluate_sample(sample_file, retries=1):
diff_merge_base=sample.diff_merge_base,
diff_active=sample.diff_active,
)
cwd = Path(repo.working_dir)

# Run sample in PythonClient
paths = list[Path]()
for a in sample.context:
paths.append(Path(a))
client = PythonClient(cwd=cwd, paths=paths)
response = await run_client(
client, sample.message_prompt, result, sample.message_history
)
await grade_and_clean_diff(
repo, response, result, comparison_diff=sample.diff_edit
)
os.chdir('../..')
results.append(result)
try:
cwd = Path(repo.working_dir)

# Run sample in PythonClient
paths = list[Path]()
for a in sample.context:
paths.append(Path(a))
client = PythonClient(cwd=cwd, paths=paths)
response = await run_client(
client, sample.message_prompt, result, sample.message_history
)
await grade_and_clean_diff(
repo, response, result, comparison_diff=sample.diff_edit
)
results.append(result)
finally:
os.chdir('../..')
return results


Expand Down

0 comments on commit 2b63cb4

Please sign in to comment.