Skip to content

Commit 0695a63

Browse files
committed
fix: adjust time limit
1 parent ed30e0a commit 0695a63

File tree

4 files changed

+10
-6
lines changed

4 files changed

+10
-6
lines changed

bigcodebench/eval/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
swallow_io,
4242
time_limit,
4343
safe_environment,
44+
TIMEOUT,
4445
)
4546

4647

@@ -178,7 +179,7 @@ def untrusted_check(
178179
gt_time_limit: float = 60
179180
) -> Tuple[str, np.ndarray]:
180181
time_limit = max(min_time_limit, gt_time_limit)
181-
timeout = max(os.getenv("BIGCODEBENCH_TIMEOUT_PER_TASK", 120), time_limit) + 1
182+
timeout = max(os.getenv("BIGCODEBENCH_TIMEOUT_PER_TASK", TIMEOUT), time_limit) + 1
182183
# shared memory objects
183184
stat = Value("i", _UNKNOWN)
184185
manager = Manager()

bigcodebench/eval/utils.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@
3131
import multiprocessing
3232
from typing import Optional
3333

34+
TIMEOUT=240
35+
3436
@contextlib.contextmanager
3537
def swallow_subprocess_output():
3638
"""Context manager to swallow stdout and stderr for subprocesses."""

bigcodebench/evaluate.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,11 @@ def evaluate(flags):
199199
def stucking_checker():
200200
while remainings:
201201
last_size = len(remainings)
202-
time.sleep(120)
202+
time.sleep(240)
203203
if last_size != len(remainings) or len(remainings) == 0:
204204
continue
205205
# Potential stucking
206-
warn("No samples had finished testing in the last 120s")
206+
warn("No samples had finished testing in the last 240s")
207207
warn(f"{len(remainings)} samples to be tested: {remainings}")
208208

209209
threading.Thread(target=stucking_checker).start()

bigcodebench/gen/util/__init__.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
swallow_io,
1212
time_limit,
1313
safe_environment,
14+
TIMEOUT,
1415
)
1516

1617

@@ -51,7 +52,7 @@ def trusted_exec(code, test_code, task_id, max_as_limit, max_data_limit, max_sta
5152
suite = loader.loadTestsFromTestCase(TestCases)
5253
test_result = unittest.TestResult()
5354
start = time.time()
54-
with safe_environment(), swallow_io(), time_limit(seconds=120):
55+
with safe_environment(), swallow_io(), time_limit(seconds=TIMEOUT):
5556
suite.run(test_result)
5657

5758
if len(test_result.failures + test_result.errors) > 0:
@@ -68,7 +69,7 @@ def trusted_exec(code, test_code, task_id, max_as_limit, max_data_limit, max_sta
6869
def trusted_check_exec(code, inputs):
6970
"""Check trusted_exec success."""
7071
try:
71-
with time_limit(seconds=120):
72+
with time_limit(seconds=TIMEOUT):
7273
trusted_exec(code, inputs)
7374
except Exception:
7475
return False
@@ -83,7 +84,7 @@ def trusted_check(
8384
max_data_limit: float,
8485
max_stack_limit: float,
8586
):
86-
timeout = os.getenv("BIGCODEBENCH_TIMEOUT_PER_TASK", 120) + 1
87+
timeout = os.getenv("BIGCODEBENCH_TIMEOUT_PER_TASK", TIMEOUT) + 1
8788
# shared memory objects
8889
times = Value("d", -1)
8990
manager = Manager()

0 commit comments

Comments
 (0)