patroni.watchdog.linux module

patroni.watchdog.linux.IOC(dir_: int, type_: str, nr: int, size: int) intView on GitHub
patroni.watchdog.linux.IOR(type_: str, nr: int, size: int) intView on GitHub
patroni.watchdog.linux.IOW(type_: str, nr: int, size: int) intView on GitHub
patroni.watchdog.linux.IOWR(type_: str, nr: int, size: int) intView on GitHub
class patroni.watchdog.linux.LinuxWatchdogDevice(device: str)View on GitHub

Bases: WatchdogBase

DEFAULT_DEVICE = '/dev/watchdog'
__init__(device: str) NoneView on GitHub
_abc_impl = <_abc._abc_data object>
_ioctl(func: int, arg: Any) NoneView on GitHub

Runs the specified ioctl on the underlying fd.

Raises WatchdogError if the device is closed. Raises OSError or IOError (Python 2) when the ioctl fails.

property can_be_disabled: bool

Returns True when watchdog will be disabled by calling close(). Some watchdog devices will keep running no matter what once activated. May raise WatchdogError if called without calling open() first.

close() NoneView on GitHub

Gracefully close watchdog device.

describe() strView on GitHub

Human readable name for this device

classmethod from_config(config: Dict[str, Any]) LinuxWatchdogDeviceView on GitHub
get_support() WatchdogInfoView on GitHub
get_timeout() intView on GitHub

Returns the current keepalive timeout in effect.

has_set_timeout() boolView on GitHub

Returns True if setting a timeout is supported.

property is_healthy: bool

Returns False when calling open() is known to fail.

property is_running: bool

Returns True when watchdog is activated and capable of performing it’s task.

keepalive() NoneView on GitHub

Resets the watchdog timer.

Watchdog must be open when keepalive is called.

open() NoneView on GitHub

Open watchdog device.

When watchdog is opened keepalive must be called. Returns nothing on success or raises WatchdogError if the device could not be opened.

set_timeout(timeout: int) NoneView on GitHub

Set the watchdog timer timeout.

Parameters:

timeout – watchdog timeout in seconds

class patroni.watchdog.linux.TestingWatchdogDevice(device: str)View on GitHub

Bases: LinuxWatchdogDevice

Converts timeout ioctls to regular writes that can be intercepted from a named pipe.

_abc_impl = <_abc._abc_data object>
get_support() WatchdogInfoView on GitHub
get_timeout() intView on GitHub

Returns the current keepalive timeout in effect.

set_timeout(timeout: int) NoneView on GitHub

Set the watchdog timer timeout.

Parameters:

timeout – watchdog timeout in seconds

timeout = 60
class patroni.watchdog.linux.WatchdogInfo(options: int, version: int, identity: str)View on GitHub

Bases: NamedTuple

Watchdog descriptor from the kernel

_asdict()View on GitHub

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('options', 'version', 'identity')
classmethod _make(iterable)View on GitHub

Make a new WatchdogInfo object from a sequence or iterable

_replace(**kwds)View on GitHub

Return a new WatchdogInfo object replacing specified fields with new values

identity: str

Alias for field number 2

options: int

Alias for field number 0

version: int

Alias for field number 1

class patroni.watchdog.linux.watchdog_infoView on GitHub

Bases: Structure

_fields_ = [('options', <class 'ctypes.c_uint'>), ('firmware_version', <class 'ctypes.c_uint'>), ('identity', <class 'patroni.watchdog.linux.c_ubyte_Array_32'>)]
firmware_version

Structure/Union member

identity

Structure/Union member

options

Structure/Union member