Skip to content

Commit 92be921

Browse files
Reduce test time (#706)
# Motivation Modified validation flow to only partially build a codebase reducing test time substantially # Content <!-- Please include a summary of the change --> # Testing <!-- How was the change tested? --> # Please check the following before marking your PR as ready for review - [ ] I have added tests for my changes - [ ] I have updated the documentation or added new documentation as needed
1 parent 49a9bc9 commit 92be921

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

codegen-examples/examples/swebench_agent_run/run_eval.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
run_agent_modal = modal.Function.from_name(app_name="swebench-agent-run", name="run_agent_modal")
1818

1919

20-
async def process_batch(examples: list[SweBenchExample], batch_size=10):
20+
async def process_batch_modal(examples: list[SweBenchExample], batch_size=10):
2121
"""Process a batch of examples concurrently.
2222
2323
Args:
@@ -90,7 +90,7 @@ async def process_batch(examples: list[SweBenchExample], batch_size=10):
9090
return results
9191

9292

93-
def process_batch_sync(examples: list[SweBenchExample], batch_size=10, codebases: dict[str, Codebase] = {}):
93+
def process_batch_local(examples: list[SweBenchExample], batch_size=10, codebases: dict[str, Codebase] = {}):
9494
"""Process a batch of examples synchronously.
9595
9696
Args:
@@ -160,9 +160,9 @@ async def run_eval(use_existing_preds: str | None, dataset: str, length: int, in
160160

161161
# Process all examples in parallel batches
162162
if local:
163-
results = process_batch_sync(examples, codebases=codebases)
163+
results = process_batch_local(examples, codebases=codebases)
164164
else:
165-
results = await process_batch(examples)
165+
results = await process_batch_modal(examples)
166166

167167
# Save individual results
168168
for result in results:

src/codegen/extensions/swebench/harness.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212

1313
from codegen import Codebase
1414
from codegen.agents.code_agent import CodeAgent
15+
from codegen.configs.models.codebase import CodebaseConfig
1516
from codegen.extensions.swebench.utils import (
1617
SweBenchExample,
1718
get_swe_bench_examples,
@@ -64,7 +65,10 @@ def run_agent_on_entry(entry: SweBenchExample, codebase: Codebase | None = None)
6465
gold_files = files_in_patch(entry.patch)
6566

6667
if codebase is None:
67-
codebase = Codebase.from_repo(repo_full_name=entry.repo, commit=base_commit, language="python") # check out the repo
68+
config = CodebaseConfig(
69+
disable_file_parse=True, # Disable the graph AND disable file parsing (file.edit only)
70+
)
71+
codebase = Codebase.from_repo(repo_full_name=entry.repo, commit=base_commit, language="python", config=config) # check out the repo
6872

6973
agent = CodeAgent(codebase=codebase)
7074

@@ -117,8 +121,9 @@ def run_agent_on_entry(entry: SweBenchExample, codebase: Codebase | None = None)
117121

118122
# Did we get a successful patch?
119123
if not model_patch:
120-
msg = "Failed to generate a patch"
121-
raise ValueError(msg)
124+
pprint.pprint("=" * 60)
125+
pprint.pprint("Failed to generate a patch")
126+
pprint.pprint("=" * 60)
122127

123128
return result
124129

0 commit comments

Comments
 (0)