Health State
- class ska_control_model.HealthState(value)
Python enumerated type for health state.
- DEGRADED = 1
The device reports this state when only part of its functionality is available. This value is optional and shall be implemented only where it is useful.
For example, a subarray may report its health state as
DEGRADEDif one of the dishes that belongs to a subarray is unresponsive (or may report health state asFAILED).Difference between
DEGRADEDandFAILEDhealth state shall be clearly identified (quantified) and documented. For example, the difference between aDEGRADEDandFAILEDsubarray might be defined as:the number or percent of the dishes available;
the number or percent of the baselines available;
sensitivity
or some other criterion. More than one criterion may be defined for a device.
- FAILED = 2
The device reports this state when unable to perform core functionality and produce valid output.
- OK = 0
A device reports this state when there are no failures that are assessed as affecting the ability of the device to perform its function.
- UNKNOWN = 3
The device reports this state when unable to determine its health.
This is also an initial state, indicating that health state has not yet been determined.
- __new__(value)
- class ska_control_model.health_rollup.HealthRollup(sources, thresholds, health_state_callback, health_summary_callback)
A class for hierarchical rollup of both health state and health summaries.
- __init__(sources, thresholds, health_state_callback, health_summary_callback)
Initialise a new instance.
- Parameters:
sources (
Collection[str]) – the names of subordinate sources, whose health contributes to overall healththresholds (
tuple[int,int,int]) –a tuple of three integers: the “failed-to-failed threshold”, the “failed-to-degraded threshold”, and the “degraded-to-degraded threshold”.
The “failed-to-degraded threshold”, for example, specifies the minimum number of FAILED or UNKNOWN sources that cause health to roll up to DEGRADED overall.
Usually this will be a positive number. If set to zero or less, it is interpreted as the maximum number of non-FAILED sources (i.e. OK or DEGRADED) for which health should still roll up to FAILED. For example, if there are three sources, then a threshold of 3 means the overall health is only FAILED if all three sources are FAILED or UNKNOWN. Equivalently, a threshold of 0 means the overall health is only FAILED if there are zero sources that OK or DEGRADED.
health_state_callback (
Callable[[HealthState],None]) – a callback to be called whenever the overall health changes.health_summary_callback (
Callable[[dict[str,Union[HealthState,dict[str,Union[HealthState, HealthSummary]]]]],None]) – a callback to be called whenever the health HealthSummary changes.
- __weakref__
list of weak references to the object (if defined)
- define(name, sources, thresholds)
Define rollup for an subordinate source.
- Parameters:
name (
str) – the name of the source for which health is being rolled upsources (
Collection[str]) – the names of subordinate sources, whose health contributes to overall healththresholds (
tuple[int,int,int]) – Defined as per__init__()above.
- Return type:
- health_changed(source, health)
Update a subordinate source health.
Call this hook to tell this health state rollup that one of its sources has a changed health.
- Parameters:
source (
str) – name of the source whose health or HealthSummary has changed.health (
HealthState) – the new health state of the source
- Return type: