Python API documentation¶
In case custom checks are required, the following classes have to be subclassed.
- class autosuspend.checks.Activity(name=None)¶
Base class for activity checks.
Subclasses must call this class’ __init__ method.
- abstract check()¶
Determine if system activity exists that prevents suspending.
- abstract classmethod create(name, config)¶
Create a new check instance from the provided configuration.
- Parameters:
name (
str
) – user-defined name for the checkconfig (
configparser.SectionProxy
) – config parser section with the configuration for this check
- Raises:
ConfigurationError – Configuration for this check is inappropriate
- Return type:
typing.TypeVar
(CheckType
, bound= Check)
- options()¶
Return the configured options as a mapping.
This is used for debugging purposes only.
- Return type:
- class autosuspend.checks.Wakeup(name=None)¶
Represents a check for potential wake up points.
- abstract check(timestamp)¶
Indicate if a wakeup has to be scheduled for this check.
- Parameters:
timestamp (
datetime.datetime
) – the time at which the call to the wakeup check is made- Return type:
- Returns:
a datetime describing when the system needs to be running again or
None
if no wakeup is required. Use timezone aware datetimes.- Raises:
TemporaryCheckError – Check execution currently fails but might recover later
SevereCheckError – Check executions fails severely
- abstract classmethod create(name, config)¶
Create a new check instance from the provided configuration.
- Parameters:
name (
str
) – user-defined name for the checkconfig (
configparser.SectionProxy
) – config parser section with the configuration for this check
- Raises:
ConfigurationError – Configuration for this check is inappropriate
- Return type:
typing.TypeVar
(CheckType
, bound= Check)
- options()¶
Return the configured options as a mapping.
This is used for debugging purposes only.
- Return type: