MCPcopy Create free account
hub / github.com/Project-MONAI/MONAI / timeout

Function timeout

monai/_extensions/loader.py:30–46  ·  view source on GitHub ↗
(time, message)

Source from the content-addressed store, hash-verified

28
29@contextmanager
30def timeout(time, message):
31 timer = None
32 try:
33 timer = Timer(time, interrupt_main)
34 timer.daemon = True
35 timer.start()
36 yield
37 except KeyboardInterrupt as e:
38 if timer is not None and timer.is_alive():
39 raise e # interrupt from user?
40 raise TimeoutError(message) from e
41 finally:
42 if timer is not None:
43 try:
44 timer.cancel()
45 finally:
46 pass
47
48
49def load_module(

Callers 1

load_moduleFunction · 0.85

Calls 1

startMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…