Skip to content

Commit 4587f05

Browse files
authored
Merge pull request #109 from commit-0/e2b-timeout
fix e2b sandbox timeout
2 parents 4043a34 + 67015ab commit 4587f05

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

commit0/harness/execution_context.py

+7-4
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,10 @@ def __init__(
245245
files_to_collect=files_to_collect,
246246
)
247247

248-
self.sb = Sandbox(timeout=timeout)
248+
# in modal, we create a sandbox for each operation. this seems super slow.
249+
# let's try having a single sandbox for multiple operations
250+
# assume the sandbox needs to be alive for 30 operations
251+
self.sb = Sandbox(timeout=timeout * 30)
249252
self.sb.commands.run("curl -LsSf https://astral.sh/uv/install.sh | sh")
250253

251254
# setup sandbox env
@@ -268,14 +271,14 @@ def exec_run_with_timeout(self, command: str) -> tuple[str, bool, float]:
268271
269272
For now, we can just check if the sandbox is still alive.
270273
"""
271-
# TODO: setup timeout
272274
start_time = time.time()
273-
result = self.sb.commands.run(command, timeout=0)
275+
# half-hour timeout per operation
276+
result = self.sb.commands.run(command, timeout=self.timeout)
274277
if self.files_to_collect is not None:
275278
for fname in self.files_to_collect:
276279
with (self.log_dir / fname).open("w") as f:
277280
f.write(self.sb.files.read(f"testbed/{fname}"))
278-
timed_out = self.sb.is_running()
281+
timed_out = not self.sb.is_running()
279282
end_time = time.time()
280283
return result.stderr, timed_out, end_time - start_time
281284

0 commit comments

Comments
 (0)