Skip to content

Commit 03a4806

Browse files
committed
docs: Add preliminary reference of interface base classes and fix docstrings
1 parent a814c02 commit 03a4806

File tree

4 files changed

+49
-5
lines changed

4 files changed

+49
-5
lines changed

docs/interfaces.rst

+5-3
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ See the following sections for more information about a specific interface:
1717

1818
interfaces/*
1919

20+
For creating custom SHC interfaces, see the following guideline:
2021

21-
Creating Custom Interfaces
22-
--------------------------
22+
.. toctree::
23+
:maxdepth: 1
24+
25+
interfaces_custom
2326

24-
TODO

docs/interfaces_custom.rst

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
2+
Creating Custom Interfaces
3+
--------------------------
4+
5+
TODO
6+
7+
8+
Interface Base and Helper Classes Reference
9+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
10+
11+
.. automodule:: shc.supervisor
12+
13+
.. autoclass:: AbstractInterface
14+
:members:
15+
16+
.. autoclass:: ServiceStatus
17+
18+
.. autoclass:: InterfaceStatus
19+
20+
.. autofunction:: interface_failure
21+
22+
23+
.. automodule:: shc.interfaces._helper
24+
25+
.. autoclass:: ReadableStatusInterface
26+
27+
.. automethod:: _get_status
28+
29+
.. autoclass:: SubscribableStatusInterface
30+
31+
.. autoclass:: SubscribableStatusConnector
32+
33+
.. automethod:: update_status
34+
35+
.. autoclass:: SupervisedClientInterface
36+
37+
.. automethod:: __init__
38+
.. automethod:: _connect
39+
.. automethod:: _run
40+
.. automethod:: _subscribe
41+
.. automethod:: _disconnect
42+
.. automethod:: wait_running

shc/interfaces/_helper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,6 @@ class SupervisedClientInterface(ReadableStatusInterface, metaclass=abc.ABCMeta):
128128
implemented in such a way, that it shuts down the run task.
129129
"""
130130
def __init__(self, auto_reconnect: bool = True, failsafe_start: bool = False):
131-
super().__init__()
132131
"""
133132
:param auto_reconnect: If True (default), the supervisor tries to reconnect the interface automatically with
134133
exponential backoff (`backoff_base` * `backoff_exponent` ^ n seconds sleep), when `_run` exits unexpectedly
@@ -139,6 +138,7 @@ def __init__(self, auto_reconnect: bool = True, failsafe_start: bool = False):
139138
backoff (see `auto_reconnect` option). Otherwise (default), the first connection attempt on startup is not
140139
retried and will raise an exception from `start()` on failure, even if `auto_reconnect` is True.
141140
"""
141+
super().__init__()
142142
self.auto_reconnect = auto_reconnect
143143
self.failsafe_start = failsafe_start and auto_reconnect
144144
self.backoff_base = 1.0 #: First wait interval for exponential backoff in seconds

shc/supervisor.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ class AbstractInterface(metaclass=abc.ABCMeta):
5050
5151
If an interface inherits from this base class, it is automatically registered for startup via :func:`main`.
5252
53-
:ivar criticality: Defines to which extend the interface's status is considered when determining the overall SHC
53+
:ivar criticality: Defines to which extent the interface's status is considered when determining the overall SHC
5454
system state, e.g. when reporting to a monitoring system or creating alerts in a user interface. A critical
5555
failure of a *CRITICAL* system is considered a critical state, whereas a critical failure of an *INFO* system
5656
only triggers an information message.

0 commit comments

Comments
 (0)