Skip to content

Commit 8937127

Browse files
hack timeout
1 parent 9096fa8 commit 8937127

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

commit0/harness/execution_context.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from e2b_code_interpreter import Sandbox
1414
from strenum import StrEnum
1515
from pathlib import Path
16-
import tempfile
1716
import time
1817
from typing import Optional, Type
1918
from types import TracebackType
@@ -261,15 +260,21 @@ def __init__(
261260
self.sb.files.write(f["dest"].name, content) # type: ignore
262261

263262
def exec_run_with_timeout(self, command: str) -> tuple[str, bool, float]:
264-
"""Execute command on E2B sandbox"""
263+
"""Execute command on E2B sandbox
264+
For timeouts, we could maybe use the error code or check whether the
265+
sandbox is still alive.
266+
267+
The exit code is given by: result.exit_code
268+
269+
For now, we can just check if the sandbox is still alive.
270+
"""
265271
# TODO: setup timeout
266272
start_time = time.time()
267-
result = self.sb.commands.run(command)
268-
return_code = result.exit_code
273+
result = self.sb.commands.run(command, timeout=0)
269274
for fname in self.files_to_collect:
270275
with (self.log_dir / fname).open("w") as f:
271276
f.write(self.sb.files.read(f"testbed/{fname}"))
272-
timed_out = False # TODO: figure this out
277+
timed_out = self.sb.is_running
273278
end_time = time.time()
274279
return result.stderr, timed_out, end_time - start_time
275280

commit0/harness/run_pytest_ids.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,8 @@
77

88
from typing import Iterator, Union
99
from commit0.harness.constants import (
10-
ABSOLUTE_REPO_DIR,
1110
EVAL_BACKENDS,
1211
Files,
13-
RELATIVE_REPO_DIR,
1412
RUN_PYTEST_LOG_DIR,
1513
RepoInstance,
1614
SimpleInstance,

0 commit comments

Comments
 (0)