MCPcopy Create free account
hub / github.com/ForgeRock/forgeops / _runwithtimeout

Function _runwithtimeout

lib/python/utils.py:231–243  ·  view source on GitHub ↗

Run a function with a timeout. If timeout is reached, exit program. target: target function to run. args: list of positional arguments passed to the target function. secs: timeout in seconds.

(target, args, secs)

Source from the content-addressed store, hash-verified

229 continue
230
231def _runwithtimeout(target, args, secs):
232 """
233 Run a function with a timeout. If timeout is reached, exit program.
234 target: target function to run.
235 args: list of positional arguments passed to the target function.
236 secs: timeout in seconds.
237 """
238 t = Thread(target=target, args=args, daemon=True)
239 t.start()
240 t.join(timeout=secs)
241 if t.is_alive():
242 print(f'{target} timed out after {secs} secs')
243 sys.exit(1)
244
245def printsecrets(ns, to_stdout=True):
246 """

Callers 1

certmanagerFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected