ska_pst.lmc.smrb
This subpackage implements SMRB component for PST.LMC.
- class ska_pst.lmc.smrb.PstSmrbComponentManager(*args: Any, **kwargs: Any)[source]
Component manager for the SMRB component for the PST.LMC subsystem.
- property number_subbands: int
Get the number of sub-bands.
- Returns
the number of sub-bands.
- Return type
int
- property ring_buffer_read: int
Get the amount of data, in bytes, that has been read.
- Returns
the amount of data that has been read.
- Return type
int
- property ring_buffer_size: int
Get the capacity of the ring buffer, in bytes.
- Returns
the capacity of the ring buffer, in bytes.
- Return type
int
- property ring_buffer_utilisation: float
Get the percentage of the ring buffer elements that are full of data.
- Returns
the percentage of the ring buffer elements that are full of data.
- Return type
float
- property ring_buffer_written: int
Get the amount of data, in bytes, that has been written.
- Returns
the amount of data that has been written.
- Return type
int
- property subband_ring_buffer_read: List[int]
Get the capacity of ring buffers for each sub-band.
- Returns
the capacity of ring buffers, in bytes, for each sub-band.
- Return type
List[int]
- property subband_ring_buffer_sizes: List[int]
Get the capacity of ring buffers for each sub-band.
- Returns
the capacity of ring buffers, in bytes, for each sub-band.
- Return type
List[int]
- property subband_ring_buffer_utilisations: List[float]
Get the percentage of full ring buffer elements for each sub-band.
- Returns
the percentage of full ring buffer elements for each sub-band.
- Return type
List[float]
- property subband_ring_buffer_written: List[int]
Get the capacity of ring buffers for each sub-band.
- Returns
the capacity of ring buffers, in bytes, for each sub-band.
- Return type
List[int]
- validate_configure_scan(configuration: dict, **kwargs: Any) None
Validate a ConfigureScan request sent from CSP.LMC to the SMRB sub-component.
This asserts the request can be converted to SMRB resources and then calls the process API to perform the validation.
- Parameters
configuration (dict) – configuration that would be used when the configure_beam and configure_scan methods are called.
task_callback (Callback) – callback for background processing to update device status.
- class ska_pst.lmc.smrb.PstSmrbProcessApi(*args: Any, **kwargs: Any)[source]
Abstract class for the API of the SMRB process.
This extends from
PstProcessApi
but provides the specific method of getting the monitoring data.
- class ska_pst.lmc.smrb.PstSmrbProcessApiGrpc(*args: Any, **kwargs: Any)[source]
This is an gRPC implementation of the PstSmrbProcessApi API.
This uses an instance of a PstGrpcLmcClient to send requests through to the SMRB.RB application. Instances of this class should be per subband, rather than one for all of SMRB as a whole.
- class ska_pst.lmc.smrb.PstSmrbProcessApiSimulator(*args: Any, **kwargs: Any)[source]
A simulator implementation version of the API of PstSmrbProcessApi.
- class ska_pst.lmc.smrb.PstSmrbSimulator(*args: Any, **kwargs: Any)[source]
Class used for simulating SMRB data.
- configure_scan(configuration: dict) None
Simulate configuring a scan.
Only the “num_subbands” parameter is used by this simulator and the “subband_ring_buffer_sizes” which should be a list the same length as the “num_subbands”
- Parameters
configuration (dict) – the configuration to be configured
- Raises
AssertionError if length of subband sizes not the same as num_subbands.
- get_data() SmrbMonitorData [source]
Get current SMRB data.
Updates the current simulated data and returns the latest data.
- Returns
current simulated SMRB data.
- Return type
- class ska_pst.lmc.smrb.SmrbMonitorData(ring_buffer_utilisation: float = 0.0, ring_buffer_size: int = 0, ring_buffer_read: int = 0, ring_buffer_written: int = 0, number_subbands: int = 0, subband_ring_buffer_utilisations: ~typing.List[float] = <factory>, subband_ring_buffer_sizes: ~typing.List[int] = <factory>, subband_ring_buffer_read: ~typing.List[int] = <factory>, subband_ring_buffer_written: ~typing.List[int] = <factory>)[source]
A data class for transfer current SMRB data between the process and the component manager.
- Variables
ring_buffer_utilisation (float) – current utilisation of the overall ring buffer.
ring_buffer_size (int) – the size of the ring buffer, in bytes.
ring_buffer_read (int) – the amount of data, in bytes, read from ring buffer.
ring_buffer_written (int) – the amount of data, in bytes, written to ring buffer.
number_subbands (int) – the number of subbands the ring buffer is configured for.
subband_ring_buffer_utilisations (List[float]) – a list of utilisation for each subband.
subband_ring_buffer_sizes (List[int]) – the allocated size of each subband within the ring buffer, in bytes.
subband_ring_buffer_read (int) – the amount of data, in bytes, read from each sub-band.
subband_ring_buffer_written (List[int]) – the amount of data, in bytes, written to each sub-band.
- number_subbands: int = 0
- ring_buffer_read: int = 0
- ring_buffer_size: int = 0
- ring_buffer_utilisation: float = 0.0
- ring_buffer_written: int = 0
- subband_ring_buffer_read: List[int]
- subband_ring_buffer_sizes: List[int]
- subband_ring_buffer_utilisations: List[float]
- subband_ring_buffer_written: List[int]
- class ska_pst.lmc.smrb.SmrbMonitorDataStore[source]
Data store use to aggregate the subband data.
- property monitor_data: SmrbMonitorData
Calculate the aggregate SMRB monitor data.
This step includes rolling up each of the individual sub-band data items to be able to calculate the overall utilisation
- Returns
the calculated monitoring data. If there is no subband data this will return a default instance of a
SmrbMonitorData
.
- class ska_pst.lmc.smrb.SmrbSubbandMonitorData(buffer_size: int, num_of_buffers: int, total_written: int = 0, total_read: int = 0, full: int = 0)[source]
A data class used for a specific SMRB subband.
- Variables
buffer_size (int) – total size of the ring buffer, including header size.
total_written (int) – total amount of data, in bytes, written to the ring buffer during scan.
total_read (int) – total amount of data, in bytes, read from the ring buffer during scan.
full (int) – the number of buffers currently in use. Needed for aggregation for the whole SMRB stats.
full – the number of buffers for subband. Needed for aggregation for the whole SMRB stats.
- buffer_size: int
- full: int = 0
- num_of_buffers: int
- total_read: int = 0
- total_written: int = 0
- property utilisation: float
Return the current utilisation of the subband ring buffer.
This is full/num_of_buffers as a percentage.
- property utilised_bytes: float
Return the number of utilised bytes.
This is utiltisation (as float not percentage) * buffer_size. Which is equivalent to full/num_of_buffers * buffer_size.
- ska_pst.lmc.smrb.calculate_smrb_subband_resources(beam_id: int, request_params: dict) Dict[int, dict] [source]
Calculate the ring buffer (RB) resources from request.
This is a common method used to calculate the keys, number of buffers, and the size of buffers for each subband required for a scan.
- Parameters
beam_id – the numerical id of the beam that this RB is for.
request_params – a dictionary of request parameters that is used to configure PST, the specific parameters for SMRB are extracted within this method.
- Returns
a dict of dicts, with the top level key being the subband id, while the second level is the specific parameters. An example would response is as follows:
{ 1: { 'data_key': "a000", 'weights_key': "a010", 'hb_nbufs': 8, 'hb_bufsz': 4096, 'db_nbufs': 8, 'db_bufsz': 1048576, 'wb_nbufs': 8, 'wb_bufsz': 8192, } }
- ska_pst.lmc.smrb.generate_data_key(beam_id: int, subband_id: int) str [source]
Generate a data header key.
The format of this is a string of 4 chars long. The first two chars is the beam_id represented in hexadecimal with left zero padding, the next is subband_id, and finally a suffix of 0.
- Parameters
beam_id – the beam_id that this LMC component is for.
subband_id – the id of the subband to generate the key for.
- Returns
the encoded key to be used for the data header ringbuffer.
- ska_pst.lmc.smrb.generate_weights_key(beam_id: int, subband_id: int) str [source]
Generate a weights header key.
The format of this is a string of 4 chars long. The first two chars is the beam_id represented in hexadecimal with left zero padding, the next is subband_id, and finally a suffix of 2.
NOTE: the weights key is 2 more than the data key, needed because SMRB.CORE has 2 keys for each ring buffer.
- Parameters
beam_id – the beam_id that this LMC component is for.
subband_id – the id of the subband to generate the key for.
- Returns
the encoded key to be used for the data header ringbuffer.