MCPcopy Create free account
hub / github.com/huggingface/evaluate / time_limit

Function time_limit

metrics/code_eval/execute.py:90–99  ·  view source on GitHub ↗
(seconds)

Source from the content-addressed store, hash-verified

88
89@contextlib.contextmanager
90def time_limit(seconds):
91 def signal_handler(signum, frame):
92 raise TimeoutException("Timed out!")
93
94 signal.setitimer(signal.ITIMER_REAL, seconds)
95 signal.signal(signal.SIGALRM, signal_handler)
96 try:
97 yield
98 finally:
99 signal.setitimer(signal.ITIMER_REAL, 0)
100
101
102@contextlib.contextmanager

Callers 1

unsafe_executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…