watchdog module
- watchdog.MIN_CORE_ALIVE_TIMEOUT = 0.5
The minimum time (seconds) to wait for the core to be alive.
- watchdog.NORMAL_CORE_ALIVE_TIMEOUT = 10
Seconds to wait for the core to be alive under normal circumstances.
- watchdog.RECOVER_ATTEMPT_INTERVAL = 0.05
Seconds to wait between recovery attempts
- watchdog.FROZEN_WARNING_TIMEOUT = 15
Seconds before the core should be considered severely frozen and a warning logged.
- watchdog.alive()
Inform the watchdog that the core is alive.
- watchdog.asleep()
Inform the watchdog that the core is going to sleep.
- watchdog.isCoreAsleep()
Finds out if the core is currently asleep (I.e. not in a core cycle). Note that if the core is actually frozen, this function will return false as it is frozen in a core cycle while awake.
- watchdog._isAlive()
- watchdog._waitUntilNormalCoreAliveTimeout(waitedSince: float)
- watchdog._watcher()
- watchdog.waitForFreezeRecovery(waitedSince: float)
- watchdog._shouldRecoverAfterMinTimeout()
- watchdog._recoverAttempt()
- class watchdog.MINIDUMP_EXCEPTION_INFORMATION
Bases:
Structure
- _fields_ = (('ThreadId', <class 'ctypes.c_ulong'>), ('ExceptionPointers', <class 'ctypes.c_void_p'>), ('ClientPointers', <class 'ctypes.c_long'>))
- ClientPointers
Structure/Union member
- ExceptionPointers
Structure/Union member
- ThreadId
Structure/Union member
- watchdog.initialize()
Initialize the watchdog.
- watchdog.terminate()
Terminate the watchdog.
- class watchdog.Suspender
Bases:
object
A context manager to temporarily suspend the watchdog for a block of code.
- class watchdog.CancellableCallThread
Bases:
Thread
A worker thread used to execute a call which must be made cancellable. If the call is cancelled, this thread must be abandoned.
This constructor should always be called with keyword arguments. Arguments are:
group should be None; reserved for future extension when a ThreadGroup class is implemented.
target is the callable object to be invoked by the run() method. Defaults to None, meaning nothing is called.
name is the thread name. By default, a unique name is constructed of the form “Thread-N” where N is a small decimal number.
args is a list or tuple of arguments for the target invocation. Defaults to ().
kwargs is a dictionary of keyword arguments for the target invocation. Defaults to {}.
If a subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread.
- execute(func, *args, pumpMessages=True, **kwargs)
- run()
Method representing the thread’s activity.
You may override this method in a subclass. The standard run() method invokes the callable object passed to the object’s constructor as the target argument, if any, with sequential and keyword arguments taken from the args and kwargs arguments, respectively.
- watchdog.cancellableExecute(func, *args, ccPumpMessages=True, **kwargs)
Execute a function in the main thread, making it cancellable. @param func: The function to execute. @type func: callable @param ccPumpMessages: Whether to pump messages while waiting. @type ccPumpMessages: bool @param args: Positional arguments for the function. @param kwargs: Keyword arguments for the function. @raise CallCancelled: If the call was cancelled.
- watchdog.cancellableSendMessage(hwnd, msg, wParam, lParam, flags=0, timeout=60000)
Send a window message, making the call cancellable. The C{timeout} and C{flags} arguments should usually be left at their default values. The call will still be cancelled if appropriate even if the specified timeout has not yet been reached. @raise CallCancelled: If the call was cancelled.