timer
Standalone implementation of time-out check on function call. Timer stops execution of wrapped function if it reaches the limit of provided time. Supports decorator feature.
- author:
Alexey Anisenkov
- contact:
- date:
March 2018
- class pilot.util.timer.TimedProcess(timeout)[source]
Process-based Timer implementation (multiprocessing module). Uses shared Queue to keep result. (completely isolated memory space) In default python implementation multiprocessing considers (c)pickle as serialization backend which is not able properly (requires a hack) to pickle local and decorated functions (affects Windows only) Traceback data is printed to stderr
- __dict__ = mappingproxy({'__module__': 'pilot.util.timer', '__doc__': '\n Process-based Timer implementation (`multiprocessing` module). Uses shared Queue to keep result.\n (completely isolated memory space)\n In default python implementation multiprocessing considers (c)pickle as serialization backend\n which is not able properly (requires a hack) to pickle local and decorated functions (affects Windows only)\n Traceback data is printed to stderr\n ', '__init__': <function TimedProcess.__init__>, 'run': <function TimedProcess.run>, '__dict__': <attribute '__dict__' of 'TimedProcess' objects>, '__weakref__': <attribute '__weakref__' of 'TimedProcess' objects>, '__annotations__': {}})
- __module__ = 'pilot.util.timer'
- __weakref__
list of weak references to the object
- class pilot.util.timer.TimedThread(timeout)[source]
Thread-based Timer implementation (threading module) (shared memory space, GIL limitations, no way to kill thread, Windows compatible)
- __dict__ = mappingproxy({'__module__': 'pilot.util.timer', '__doc__': '\n Thread-based Timer implementation (`threading` module)\n (shared memory space, GIL limitations, no way to kill thread, Windows compatible)\n ', '__init__': <function TimedThread.__init__>, 'execute': <function TimedThread.execute>, 'run': <function TimedThread.run>, '__dict__': <attribute '__dict__' of 'TimedThread' objects>, '__weakref__': <attribute '__weakref__' of 'TimedThread' objects>, '__annotations__': {}})
- __module__ = 'pilot.util.timer'
- __weakref__
list of weak references to the object
- exception pilot.util.timer.TimeoutException(message, timeout=None, *args)[source]
-
- __module__ = 'pilot.util.timer'
- __weakref__
list of weak references to the object
- pilot.util.timer.Timer
alias of
TimedProcess