PST Base Monitor Data Handler

This module provides the base classes for handling monitoring data handling.

class ska_pst_lmc.component.monitor_data_handler.MonitorDataStore[source]

Generic monitoring data store that handles subband data.

This is an abstract class that other classes should extend to allow following for a contract about how to handle subband data.

Initialise data store.

update_subband(subband_id: int, subband_data: S) None[source]

Update the stored subband data for a given subband id.

This just updates an internal dictionary. Subclasses should only override this method if there is a specific reason to handle a subband, as the monitor_data method should be the main place to handle aggregation.

Parameters
  • subband_id – the subband that is being updated.

  • subband_data – the data for the current subband.

reset() None[source]

Reset the monitoring data state.

property monitor_data: T

Return the current calculated monitoring data.

Implementations of this should aggregate the monitoring data to be what is the current snapshot of data.

Returns

current monitoring data.

class ska_pst_lmc.component.monitor_data_handler.MonitorDataHandler(data_store: MonitorDataStore[S, T], monitor_data_callback: Callable[[T], None])[source]

Generic monitor data handler for subband.

This handler needs to be constructed with a MonitorDataStore that takes subband monitoring data (type S) and can aggregate that data to return a combined monitoring data object (type T).

Since monitoring happens in the background and asynchronously the updates to the data store is guarded by a threading lock.

There should be no need to override any of these methods.

Initialise data handler.

Parameters
  • data_store – the monitoring data store to handle subband monitoring data.

  • monitor_data_callback – the callback to call once subband monitoring data has been merged with other subband data.

handle_subband_data(subband_id: int, subband_data: S) None[source]

Handle subband monitoring data.

This will call the data store’s MonitorDataStore.update_subband() within a write lock. After updating the data store it will call the monitoring callback with the latest monitoring data from the data store.

property monitor_data: T

Get current monitor data.

reset_monitor_data() None[source]

Reset the monitor data store.

update_monitor_data(notify: bool) None[source]

Update monitoring data.

This method is used internally as well as by DSP to recalculate monitoring data. To force callback notify must be set to True.

Parameters

notify (bool) – whether to notify callback that there has been an update.