Event Handlers
Base Event Handler
- class ska_csp_lmc_common.event.BaseCspEventHandler(health_supervisor: object | None, on_op_state_changed: Callable, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Bases:
objectBase class implementing CSP domain orchestration logic.
This class provides reusable logic to process events coming from the event manager.
The handler is callback-driven, allowing flexible composition of behaviors without tight coupling to specific models or devices.
- __init__(health_supervisor: object | None, on_op_state_changed: Callable, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Initialize the base CSP event handler.
- Parameters:
health_supervisor – Supervisor responsible for aggregating subsystem health and coordinating higher-level evaluation.
on_op_state_changed – Callback for operational state changes. Expected signature: (component, state) -> None
on_health_event – Callback for health-related updates. Expected signature: (component, state=…, health=…, admin_mode=…) -> None
on_health_info – Callback for detailed health info propagation. Expected signature: (fqdn, health_info) -> None
on_quality_metrics – Callback for subsystem quality metrics updates.
logger – Logger instance.
- BASE_EVENT_MAP = {'adminmode': ('on_adminmode', False), 'healthinfo': ('on_healthinfo', True), 'healthstate': ('on_healthstate', False), 'state': ('on_state', False)}
- _build_event_map()
Build the effective event map for this handler instance.
This method merges all
BASE_EVENT_MAPdefinitions across the class inheritance hierarchy using the Method Resolution Order (MRO).For each event key: - the associated method name is resolved into a bound method of this instance via
getattr(self, method_name)- the tuple(callable, initial_flag)is stored in the final map
- get_event_map()
Return the full event map for this handler, including dynamic events. Builds the map on the first call if it doesn’t exist yet.
- on_state(evt: CspEvent)
Handle a subsystem operational state change event.
This method: - notifies the operational state callback - optionally triggers health evaluation logic
- Parameters:
evt – Event containing the component and new state value.
- on_healthstate(evt: CspEvent)
Handle a subsystem health state change event.
Converts the raw value to
HealthStateand forwards it to the health callback.- Parameters:
evt – Event containing the component and health state value.
- on_healthinfo(evt: CspEvent)
Handle detailed health information updates.
This method forwards subsystem health info to the configured callback.
- Parameters:
evt – Event containing component FQDN and health info payload.
- on_adminmode(evt: CspEvent)
Handle a subsystem admin mode change event.
Notifies the health supervisor so that administrative constraints can be considered in system-wide evaluation.
- Parameters:
evt – Event containing the component and admin mode value.
- on_quality_metrics(evt: CspEvent)
Handle quality metrics updates.
This method forwards quality metrics info to the configured callback.
- Parameters:
evt – Event containing component FQDN and quality metrics info payload.
Controller Event Handler
- class ska_csp_lmc_common.event.ControllerCspEventHandler(health_supervisor: object | None, on_op_state_changed: Callable, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Bases:
BaseCspEventHandlerController-specific CSP event handler.
- __init__(health_supervisor: object | None, on_op_state_changed: Callable, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Initialize the base CSP event handler.
- Parameters:
health_supervisor – Supervisor responsible for aggregating subsystem health and coordinating higher-level evaluation.
on_op_state_changed – Callback for operational state changes. Expected signature: (component, state) -> None
on_health_event – Callback for health-related updates. Expected signature: (component, state=…, health=…, admin_mode=…) -> None
on_health_info – Callback for detailed health info propagation. Expected signature: (fqdn, health_info) -> None
on_quality_metrics – Callback for subsystem quality metrics updates.
logger – Logger instance.
- BASE_EVENT_MAP = {'adminmode': ('on_adminmode', False), 'cbfpacketcorruptionrate': ('on_quality_metrics', True), 'cbfpacketlossrate': ('on_quality_metrics', True), 'healthinfo': ('on_healthinfo', True), 'healthstate': ('on_healthstate', False), 'spslinkuppercent': ('on_quality_metrics', True), 'state': ('on_state', False)}
Subarray Event Handler
- class ska_csp_lmc_common.event.SubarrayCspEventHandler(health_supervisor: object | None, obs_state_supervisor: object | None, on_op_state_changed: Callable, on_obs_state_changed: Callable | None = None, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Bases:
BaseCspEventHandlerSpecialized handler for CSP Subarray devices.
Extends the base handler logic by handling observation state updates in addition to operational and health state processing.
- __init__(health_supervisor: object | None, obs_state_supervisor: object | None, on_op_state_changed: Callable, on_obs_state_changed: Callable | None = None, on_health_event: Callable | None = None, on_health_info: Callable | None = None, on_quality_metrics: Callable | None = None, logger=None)
Initialize the subarray event handler.
- Parameters:
health_supervisor – Full health supervisor object.
obs_state_supervisor – Full observation state supervisor object.
on_op_state_changed – Callback for operational state changes.
on_obs_state_changed – Callback for observation state changes.
on_health_event – Callback for health-related events.
on_health_info – Callback for detailed health info updates.
on_quality_metrics – Callback for subsystem quality metrics updates.
logger – Logger instance.
- BASE_EVENT_MAP = {'adminmode': ('on_adminmode', False), 'healthinfo': ('on_healthinfo', True), 'healthstate': ('on_healthstate', False), 'obsstate': ('on_obsstate', False), 'percentagedatareceived': ('on_quality_metrics', True), 'percentagevalidpolarisationcorrection': ('on_quality_metrics', True), 'percentagevalidpstbeam': ('on_quality_metrics', True), 'percentagevalidstationbeam': ('on_quality_metrics', True), 'processorethernetlockedpercent': ('on_quality_metrics', True), 'processorsreadypercent': ('on_quality_metrics', True), 'pssbeamdelayreadypercent': ('on_quality_metrics', True), 'psshostsresolvedpercent': ('on_quality_metrics', True), 'pssjonesage': ('on_quality_metrics', True), 'pssjonesappliedpercent': ('on_quality_metrics', True), 'pstbeamdelayreadypercent': ('on_quality_metrics', True), 'psthostsresolvedpercent': ('on_quality_metrics', True), 'pstjonesage': ('on_quality_metrics', True), 'pstjonesappliedpercent': ('on_quality_metrics', True), 'sdphostsresolvedpercent': ('on_quality_metrics', True), 'spsflagspercentmean': ('on_quality_metrics', True), 'spsrmsinrange': ('on_quality_metrics', True), 'state': ('on_state', False), 'stationbeamdelayreadypercent': ('on_quality_metrics', True)}
- on_obsstate(evt: CspEvent)
Handle a subsystem observation state change event.
Converts the value to
ObsStateand forwards it to the observation state callback.- Parameters:
evt – Event containing the component and observation state.