MCPcopy Create free account
hub / github.com/RUC-NLPIR/WebThinker / time_limit

Function time_limit

scripts/lcb_runner/evaluation/utils_execute.py:121–130  ·  view source on GitHub ↗
(seconds)

Source from the content-addressed store, hash-verified

119
120@contextlib.contextmanager
121def time_limit(seconds):
122 def signal_handler(signum, frame):
123 raise TimeoutException("Timed out!")
124
125 signal.setitimer(signal.ITIMER_REAL, seconds)
126 signal.signal(signal.SIGALRM, signal_handler)
127 try:
128 yield
129 finally:
130 signal.setitimer(signal.ITIMER_REAL, 0)
131
132
133@contextlib.contextmanager

Callers 1

unsafe_executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected