ska_pst.lmc.component

This package is for common component classes for PST.LMC.

class ska_pst.lmc.component.MonitorDataHandler(data_store: MonitorDataStore[SubbandMonitorDataType, MonitorDataType], monitor_data_callback: Callable[[MonitorDataType], 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.

handle_subband_data(subband_id: int, subband_data: SubbandMonitorDataType) 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: MonitorDataType

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.

class ska_pst.lmc.component.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.

property monitor_data: MonitorDataType

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.

reset() None[source]

Reset the monitoring data state.

update_subband(subband_id: int, subband_data: SubbandMonitorDataType) 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.

class ska_pst.lmc.component.PstApiDeviceInterface[source]

A generic PstDeviceInterface used by API based device components.

This interface is used by devices like SMRB.MGMT, RECV.MGMT, etc that wrap APIs to processes like SMRB.CORE. These devices all get and process monitoring data from the remote system.

This is a generic class over the class of the data model for the API monitoring. This avoids unnecessary casts within the TANGO device implementation.

handle_monitor_data_update(monitor_data: T) None[source]

Handle monitoring data.

This is a generic extension of PstDeviceInterface to allow for handling of monitoring data. This is designed so that there is no need to send through a monitoring callback to the component manager.

property process_api_endpoint: str

Get the process API endpoint.

class ska_pst.lmc.component.PstBaseDevice(*args: Any, **kwargs: Any)[source]

Base class for all the TANGO devices in PST.LMC.

This extends from CspSubElementObsDevice but is also generic in the type of the component manager.

The CspSubElementObsDevice class is used as a base rather than a SKASubarray due to the fact this PST is a software subelement within CSP.

class ConfigureScanCommand(*args: Any, **kwargs: Any)[source]

A class for the ObsDevice ConfigureScan command.

This overrides the constructor to ensure that the correct validator is used. The base CSP ObsDevice ConfigureScanCommand doesn’t allow passing through a validator.

class ScanCommand(*args: Any, **kwargs: Any)[source]

A class for the PST’s ConfigureScan command.

always_executed_hook() None[source]

Execute call before any TANGO command is executed.

property beam_id: int

Get the ID of the beam this device belongs to.

property component_manager: T

Get component manager.

Overrides the super class property of component_manager to be typesafe.

Returns

the component manager casted to type T.

create_component_manager() T[source]

Create and return a component manager for this device.

Raises

NotImplementedError – for no implementation

delete_device() None[source]

Delete resources allocated in init_device.

This method allows for any memory or other resources allocated in the init_device method to be released. This method is called by the device destructor and by the device Init command.

property device_name: str

Get the name of the device.

This is the relative device name (e.g. low_psi/beam/01) and not the FQDN which can include the Tango DB in a URL.

property facility: TelescopeFacilityEnum

Get the facility that this device is being used for.

handle_attribute_value_update(attribute_name: str, value: Any) None[source]

Handle update of a device attribute value.

Parameters
  • attribute_name (str) – the name of the attribute to update.

  • value (Any) – the new value of the attribute to update to.

handle_communication_state_change(communication_state: ska_control_model.CommunicationStatus) None[source]

Handle a change in device’s communication state.

This just calls the SKABaseDevice._communication_state_changed method

handle_component_state_change(*args: Any, **kwargs: Any) None[source]

Handle change in this device’s state.

This overrides the PstDeviceInterface and calls _component_state_changed on this class.

handle_fault(fault_msg: str) None[source]

Handle putting the device into a fault state.

init_command_objects() None[source]

Set up the command objects.

init_device() None[source]

Initialise the attributes and properties of the PstReceive.

This overrides the SKABaseDevice.

set_logging_level(value: ska_control_model.LoggingLevel) None[source]

Set the logging level for the device.

Both the Python logger and the TANGO logger are updated.

This calls SKABaseDevice.set_logging_level() then delegates to the component manager to perform necessary updates. This is used by having the BEAM.MGMT to update the subordinate Tango devices, which in turn update the core apps.

Parameters

value – Logging level for logger

Raises

LoggingLevelError – for invalid value

simulationMode(value: ska_control_model.SimulationMode) None

Set the simulation mode.

Parameters

value – The simulation mode, as a SimulationMode value

property subsystem_id: str

Get the sub-system id where device is deployed.

update_health_state(health_state: ska_control_model.HealthState) None[source]

Update the health state of the device.

This delegates to the base class _update_health_state

class ska_pst.lmc.component.PstBaseProcessDevice(*args: Any, **kwargs: Any)[source]

Base class for all the TANGO devices that manager an external process.

This extends from PstBaseDevice but exposes the ConfigureBeam method. This allows for setting up the beam related configuration that may not change as often as the scan configuration.

class InitCommand(*args: Any, **kwargs: Any)[source]

A class for the CspSubElementObsDevice’s init_device() “command”.

do() Tuple[ska_tango_base.commands.ResultCode, str][source]

Stateless hook for device initialisation.

Returns

A tuple containing a return code and a string message indicating status. The message is for information purpose only.

Return type

(ResultCode, str)

init_command_objects() None[source]

Set up the command objects.

is_ConfigureBeam_allowed() bool[source]

Return whether the ConfigureBeam command may be called in the current state.

Returns

whether the command may be called in the current device state

Return type

bool

is_DeconfigureBeam_allowed() bool[source]

Return whether the DeconfigureBeam command may be called in the current state.

Returns

whether the command may be called in the current device state

Return type

bool

is_DeconfigureScan_allowed() bool[source]

Return whether the DeconfigureScan command may be called in the current state.

Returns

whether the command may be called in the current device state

Return type

bool

is_ValidateConfigureScan_allowed() bool[source]

Return whether the ValidateConfigureScan command may be called in the current state.

Returns

whether the command may be called in the current device state

Return type

bool

monitoringPollingRate(monitoring_polling_rate_ms: int) None

Update the monitoring polling rate.

property monitoring_polling_rate_ms: int

Get the monitoring polling rate.

class ska_pst.lmc.component.PstComponentManager(*args: Any, **kwargs: Any)[source]

Base Component Manager for the PST.LMC. subsystem.

This base class is used to provide the common functionality of the PST TANGO components, such as providing the the communication with processes that are running (i.e. RECV, DSP, or SMRB).

This class also helps abstract away calling out to whether we’re using a simulated process or a real subprocess.

This component manager extects from the CspObsComponentManager. For more details about this check the CSP obs component manager docs.

property beam_id: int

Return the beam id for the current component.

This value is set during the construction of the component manager, and is injected from the DeviceID property of the TANGO device.

property config_id: str

Return the configuration id.

configure_beam(task_callback: Optional[Callable[[...], Any]] = None, **kwargs: Any) Tuple[ska_tango_base.executor.TaskStatus, str][source]

Configure the beam specific configuration of the component.

Parameters
  • task_callback (Callback) – callback for background processing to update device status.

  • kwargs (dict) – configuration for beam

configure_scan(task_callback: Optional[Callable[[...], Any]] = None, **kwargs: Any) Tuple[ska_tango_base.executor.TaskStatus, str]

Configure the component for a scan.

Parameters
  • task_callback (Callback) – callback for background processing to update device status.

  • kwargs (dict) – the configuration to be configured

deconfigure_beam(task_callback: Optional[Callable[[...], Any]] = None) Tuple[ska_tango_base.executor.TaskStatus, str][source]

Deconfigure the component’s beam configuration.

This will release all the resources associated with the component, including the SMRBs.

Parameters

task_callback (Callback) – callback for background processing to update device status.

deconfigure_scan(task_callback: Optional[Callable[[...], Any]] = None) Tuple[ska_tango_base.executor.TaskStatus, str][source]

Deconfigure this component for current scan configuration.

Parameters

task_callback (Callback) – callback for background processing to update device status.

property device_name: str

Get the name of the current device.

go_to_fault(fault_msg: str, task_callback: Optional[Callable[[...], Any]] = None) Tuple[ska_tango_base.executor.TaskStatus, str][source]

Set the component into a FAULT state.

For BEAM this will make the sub-devices be put into a FAULT state. For API backed component managers it is expected that the service backing that API should be put into a FAULT state.

obsreset(task_callback: Optional[Callable[[...], Any]] = None) Tuple[ska_tango_base.executor.TaskStatus, str]

Reset the component to unconfigured but do not release resources.

property scan_id: int

Return the scan id.

set_logging_level(log_level: ska_control_model.LoggingLevel) None[source]

Set LoggingLevel.

Parameters

log_level – The required TANGO LoggingLevel

Returns

None.

property simulation_mode: ska_control_model.SimulationMode

Get value of simulation mode state.

Returns

current simulation mode state.

start_communicating() None

Establish communication with the component, then start monitoring.

This is the place to do things like:

  • Initiate a connection to the component (if your communication is connection-oriented)

  • Subscribe to component events (if using “pull” model)

  • Start a polling loop to monitor the component (if using a “push” model)

stop_communicating() None

Cease monitoring the component, and break off all communication with it.

For example,

  • If you are communicating over a connection, disconnect.

  • If you have subscribed to events, unsubscribe.

  • If you are running a polling loop, stop it.

class ska_pst.lmc.component.PstDeviceInterface[source]

A purely abstract class to be implemented by TANGO device classes.

This class is used to abstract away any TANGO functionality that component managers need to callback to the TANGO device and in turn allow passing of the TANGO device itself to the component manager but is abstracted. This class itself can be extended for a particular device/component_manager combination where there is a need for more specific functionality but without the need of exposing a callback.

By being an abstract class this can be mocked to be used in testing.

property beam_id: int

Get the beam id for the current device.

property device_name: str

Get the name of the device.

property facility: TelescopeFacilityEnum

Get the facility that this device is being used for.

handle_attribute_value_update(attribute_name: str, value: Any) None[source]

Handle update of a device attribute value.

Parameters
  • attribute_name (str) – the name of the attribute to update.

  • value (Any) – the new value of the attribute to update to.

handle_communication_state_change(communication_state: ska_control_model.CommunicationStatus) None[source]

Handle a change in device’s communication state.

handle_component_state_change(*args: Any, **kwargs: Any) None[source]

Handle a change in the component’s state.

handle_fault(fault_msg: str) None[source]

Handle device going into a fault state.

property monitoring_polling_rate_ms: int

Get the monitoring polling rate, in milliseconds.

property subsystem_id: str

Get the sub-system id where device is deployed.

update_health_state(health_state: ska_control_model.HealthState) None[source]

Update the health state of device.

Parameters

health_state (HealthState) – the new health state of the TANGO device.

class ska_pst.lmc.component.PstGrpcLmcClient(client_id: str, endpoint: str, logger: Optional[Logger], **kwargs: Any)[source]

The client API that connects to a remote gRPC service.

This client is a wrapper around the PstLmcServiceStub that is generated from the gRPC/Protobuf bindings.

Once fully implemented this class will be able to be used by any of the LMC components PstProcessApi implementations.

abort() None[source]

Abort scanning.

This method is to be used by the LMC device that needs to abort a long running action, in particular scan. The ObsState model allows for this to be called if in IDLE (resources assigned), CONFIGURING (configuring a scan), READY (configured for a scan but not scanning), SCANNING (a scan is running), or RESETTING (is trying to reset from ABORTED/FAULT state).

After this call the state of the service should be ABORTED.

configure_beam(request: ska_pst.grpc.lmc.ska_pst_lmc_pb2.ConfigureBeamRequest) bool[source]

Call configure_beam on remote gRPC service.

configure_scan(request: ska_pst.grpc.lmc.ska_pst_lmc_pb2.ConfigureScanRequest) bool[source]

Call configure_scan on remote gRPC service.

connect() bool[source]

Connect client to the remote server.

This is used to let the server know that a client has connected.

deconfigure_beam() bool[source]

Call deconfigure_beam on remote gRPC service.

deconfigure_scan() bool[source]

Call deconfigure_scan on remote gRPC service.

get_beam_configuration() ska_pst.grpc.lmc.ska_pst_lmc_pb2.GetBeamConfigurationResponse[source]

Call get_beam_configuration on remote gRPC service.

get_env() dict[source]

Get the enviroment values from the remote gRPC service.

This will map the Protobuf EnvVal objects to the appropriate Python types.

Returns

the enviroment values from the remote gRPC service.

Return type

dict

get_log_level(request: ska_pst.grpc.lmc.ska_pst_lmc_pb2.GetLogLevelRequest) ska_pst.grpc.lmc.ska_pst_lmc_pb2.LogLevel[source]

Get the LogLevel of the remote gRPC service.

Returns

The current LogLevel of the remote gRPC service.

Return type

LogLevel

get_scan_configuration() ska_pst.grpc.lmc.ska_pst_lmc_pb2.GetScanConfigurationResponse[source]

Call get_scan_configuration on remote gRPC service.

get_state() ska_control_model.ObsState[source]

Call get_state on remote gRPC service.

go_to_fault() None[source]

Put the gRPC service in to a FAULT state.

monitor(abort_event: Event, polling_rate: int = 5000) Generator[ska_pst.grpc.lmc.ska_pst_lmc_pb2.MonitorResponse, None, None][source]

Call monitor on reqmore gRPC service.

Parameters
  • abort_event – a threading.Event that can be used to signal to stop monitoring.

  • polling_rate – the rate, in milliseconds, at which the monitoring should poll. The default value is 5000ms (i.e. 5 seconds).

reset() None[source]

Reset service.

This method is to be used by the LMC device that is currently in an ABORTED or FAULT state to reset the service. After this call the state of the service should be in IDLE (resources assigned and not configured for a scan).

set_log_level(request: ska_pst.grpc.lmc.ska_pst_lmc_pb2.SetLogLevelRequest) None[source]

Set the LogLevel of the remote gRPC service.

Parameters

request – The request containing LogLevel to be set on the remote gRPC service.

Returns

None.

start_scan(request: ska_pst.grpc.lmc.ska_pst_lmc_pb2.StartScanRequest) bool[source]

Call start_scan on remote gRPC service.

stop_scan() bool[source]

Call stop_scan on remote gRPC service.

class ska_pst.lmc.component.PstObsStateMachine(callback: Optional[Callable] = None, **extra_kwargs: Any)[source]

State machine for observation state.

This class to be used in place of the ska_control_model._ObsStateMachine state machine to allow for the specifics of the state machine needed for the PST Process sub-devices (i.e. SMRB.MGMT, DSP.MGMT, RECV.MGMT, etc)

This is based off the SKA ObsStateModel

The full list of supported states are:

  • EMPTY: the PST subdevice has no configuration

  • RESOURCING_EMPTY: the PST subdevice is unresourced, but performing a configure beam operation

  • RESOURCING_IDLE: the PST subdevice is beam configured, and is currently finishing the configure beam operation

  • IDLE: the PST subdevice is beam configured but not scan configured

  • CONFIGURING_IDLE: the PST subdevice is beam configured but not scan configured; it is currently performing a configure scan operation

  • CONFIGURING_READY: the PST subdevice is scan configured; and is currently finishing the configure scan operation

  • READY: the PST subdevice is scan configured and waiting for a start scan request

  • SCANNING: the PST subdevice is scanning

  • ABORTING: the PST subdevice is aborting

  • ABORTED: the PST subdevice has aborted

  • RESETTING: the PST subdevice is resetting from an ABORTED or FAULT state back to IDLE

  • FAULT: the PST subdevice has encountered an observation fault.

A diagram of the state machine is shown below. Reflexive transitions and transitions to FAULT obs state are omitted to simplify the diagram.

@startuml PST Subdevice State Machine
EMPTY: The PST subdevice has no configuration
RESOURCING: The PST subdevice is performing a configure beam operation
IDLE: The PST subdevice is beam configured but has no scan configuration
CONFIGURING: The PST subdevice is performing a configure scan operation
READY: The PST subdevice is configured for a scan
SCANNING: The PST subdevice is scanning
ABORTING: The PST subdevice is aborting
ABORTED: The PST subdevice has aborted
RESETTING: The PST subdevice is resetting to EMPTY\nfrom FAULT or ABORTED state
FAULT: The PST subdevice has faulted

EMPTY -down-> RESOURCING: assign_invoked
RESOURCING -up-> EMPTY: assign_completed
RESOURCING -up-> EMPTY: release_completed
RESOURCING -down-> IDLE: assign_completed
RESOURCING -down-> IDLE: release_completed
IDLE -up-> RESOURCING: assign_invoked
IDLE -up-> RESOURCING: release_invoked
IDLE -down-> CONFIGURING: configure_invoked
IDLE -left-> ABORTING: abort_invoked
CONFIGURING -up-> IDLE: configure_completed
CONFIGURING -left-> ABORTING: abort_invoked
CONFIGURING -down-> READY: configure_completed
CONFIGURING -left-> ABORTING: abort_invoked
READY -up-> CONFIGURING: configure_invoked
READY -up-> IDLE: component_unconfigured
READY -down-> SCANNING: component_scanning
READY -left-> ABORTING: abort_invoked
SCANNING -up-> READY: component_not_scanning
SCANNING -left-> ABORTING: abort_invoked
ABORTING -up-> ABORTED: abort_completed
ABORTED -up-> RESETTING: obsreset_invoked
RESETTING -down-> ABORTING: abort_invoked
RESETTING -right-> EMPTY: obsreset_completed
[*] -up-> FAULT: component_obsfault\n(from any state)
FAULT -up-> RESETTING: obsreset_invoked
@enduml

Diagram of the PST subdevice state machine

class ska_pst.lmc.component.PstProcessApi(*args: Any, **kwargs: Any)[source]

Abstract class for the API of the PST.LMC processes like RECV, SMRB, etc.

abort() None[source]

Abort a scan.

configure_beam(configuration: dict) None[source]

Configure beam for service.

Parameters

configuration – Dictionary of resources to allocate.

configure_scan(configuration: dict) None[source]

Configure a scan.

Parameters

configuration – the scan configuration for the device.

connect() None[source]

Connect to the external process.

deconfigure_beam() None[source]

Deconfigure beam to release all resources.

deconfigure_scan() None[source]

Deconfigure a scan.

disconnect() None[source]

Disconnect from the external process.

get_env() dict[source]

Get the environment properties for the service.

go_to_fault() None[source]

Set remote service in a FAULT state.

This doesn’t take a callback as we want a synchronous call.

monitor(subband_monitor_data_callback: Callable[[...], None], polling_rate: int = 5000, monitor_abort_event: Optional[Event] = None) None[source]

Monitor data of remote service.

This needs to be implemented as a background task

Parameters
  • subband_monitor_data_callback – callback to use when there is an update of the sub-band monitor data.

  • polling_rate – the rate, in milliseconds, at which the monitoring should poll. The default value is 5000ms (i.e. 5 seconds).

  • monitor_abort_event – a threading.Event that can be used to signal to stop monitoring. If not set then the background task will create one.

reset() None[source]

Reset the component.

set_log_level(log_level: ska_control_model.LoggingLevel) None[source]

Set the LogLevel of the service.

Parameters

log_level – The required TANGO LoggingLevel

Returns

None.

start_scan(scan_id: int, **kwargs: Any) None[source]

Start a scan.

Parameters
  • scan_id (int) – the ID for the scan.

  • kwargs (dict) – additional arguments, needed to allow for future proofing of scan request coming from TM / CSP.

stop_monitoring() None[source]

Stop background monitoring.

stop_scan() None[source]

Stop a scan.

validate_configure_beam(configuration: dict) None[source]

Validate a configure beam for service.

Parameters

configuration – Dictionary of resources to allocate.

Raises

ValidationError – if there an issue validating the request. The error message contains the details.

validate_configure_scan(configuration: dict) None[source]

Validate a configure_scan request.

Parameters

configuration – the scan configuration for the device.

Raises

ValidationError – if there an issue validating the request. The error message contains the details.

class ska_pst.lmc.component.PstProcessApiGrpc(*args: Any, **kwargs: Any)[source]

Helper class to be used by subclasses of PstProcessApi that use gRPC.

This class should be added as a parent class of gRPC client APIs. Common logic of methods can be refactored to this class. This also means that requests that have empty request messages can be handled by this class specifically. Where request parameters need to be converted to the appropriate protobuf message, then subclasses of this class need to implement the _get_<method_name>_request.

For monitoring the subclasses have to handle the _handle_monitor_response method.

abort() None

Abort a scan.

configure_beam(configuration: dict) None

Configure the beam with the resources definted in configuration.

Parameters

configuration – Dictionary of resources to allocate.

configure_scan(configuration: dict) None

Configure a scan.

For SMRB this is a no-op command. There is nothing on the server that would be performed and executing this will do nothing.

Parameters

configuration – the configuration for the scan.

connect() None

Connect to the external process.

Connects to the remote gRPC service. It also establishes a

deconfigure_beam() None

Deconfigure the beam, releasing all resources.

deconfigure_scan() None

Deconfigure a scan.

disconnect() None

Disconnect from the external process.

This will ensure any monitoring background task has stopped.

get_env() dict

Get the environment properties from the remote gRPC service.

get_log_level() ska_control_model.LoggingLevel[source]

Get the LogLevel of the remote gRPC service.

go_to_fault() None

Put remote service into FAULT state.

This is used to put the remote service into a FAULT state to match the status of the LMC component.

monitor
reset() None

Reset service.

set_log_level(log_level: ska_control_model.LoggingLevel) None

Set the LogLevel of the remote gRPC service.

Parameters

log_level – The required TANGO LoggingLevel.

Returns

None.

start_scan(scan_id: int, **kwargs: Any) None

Start scanning.

Parameters
  • scan_id (int) – the ID for the scan.

  • kwargs (dict) – additional arguments, needed to allow for future proofing of scan request coming from TM / CSP.

stop_monitoring() None

Stop background monitoring.

stop_scan() None

End a scan.

This will call out to the remote service to end a scan. It will also stop monitoring as monitoring is only valid if the service is in a scan.

validate_configure_beam(configuration: dict) None

Validate configuration for a configure_beam request.

Parameters

configuration – Dictionary of resources to allocate.

Raises

ValidationError – if there an issue validating the request. The error message contains the details.

validate_configure_scan(configuration: dict) None

Validate a configure_scan request.

Parameters

configuration – the configuration for the scan.

Raises

ValidationError – if there an issue validating the request. The error message contains the details.

class ska_pst.lmc.component.PstProcessApiSimulator(*args: Any, **kwargs: Any)[source]

Abstract class for the Simulated API of the PST.LMC processes like RECV, SMRB, etc.

abort() None

Abort a scan.

configure_beam(configuration: dict) None

Configure the beam.

Parameters

configuration – dictionary of parameters to be configured and their requested values

configure_scan(configuration: dict) None

Configure a scan.

Parameters

configuration – the configuration for the scan.

connect() None

Connect to the external process.

deconfigure_beam() None

Deconfigure the beam.

The default implementation of this does nothing.

deconfigure_scan() None

Deconfigure a scan.

disconnect() None

Disconnect from the external process.

get_env() dict

Get the environment properties for the service.

go_to_fault() None

Set simulator into a FAULT state.

If simulator is scanning then stop scanning.

monitor
reset() None

Reset service when in ABORTED / FAULT state.

set_log_level(log_level: ska_control_model.LoggingLevel) None

Set simulator LoggingLevel of the PST.LMC processes like RECV, SMRB, etc.

Parameters

log_level – The required TANGO LoggingLevel

Returns

None.

start_scan(scan_id: int, **kwargs: Any) None

Start a scan.

Parameters
  • scan_id (int) – the ID for the scan.

  • kwargs (dict) – additional arguments, needed to allow for future proofing of scan request coming from TM / CSP.

stop_monitoring() None

Stop the monitoring background thread by setting event.

stop_scan() None

Stop a scan.

validate_configure_beam(configuration: dict) None

Validate configure beam request.

validate_configure_scan(configuration: dict) None

Validate configure scan request.

class ska_pst.lmc.component.PstProcessApiSubcomponentManager(*args: Any, **kwargs: Any)[source]

A base subomponent Manager for the PST.LMC. that uses an API.

This extends from the PstBaseSubcomponentManager

connect() None

Establish connection to API component.

deconfigure_beam() None

Deconfigure the component’s beam configuration.

This will release all the resources associated with the component, including the SMRBs.

disconnect() None

Establish connection to API component.

get_env() dict[source]

Get the environment properties for the service.

property monitor_data: MonitorDataType

Get the current monitoring data.

validate_configure_scan(configuration: dict, **kwargs: Any) None

Validate configure scan request with the specific configuration of the component.

Note this is for the whole ConfigureScan request for a PST BEAM component, which includes checking both the beam and scan configuration is correct. This is due to the fact that clients of BEAM.MGMT only exposes a ConfigureScan request as it’s an Obs device.

Parameters

configuration (dict) – the configuration to validate.

class ska_pst.lmc.component.PstSimulator(*args: Any, **kwargs: Any)[source]

A base class for simulators used when the BEAM is in simulation mode.

A simulator class is needed for each subcomponent. This class is generic over the subband monitoring data type and a monitoring data store.

This is an abstract class and sub-classes of this are expected to implement the _update() method.

abort() None

Tell the component to abort whatever it was doing.

configure_scan(configuration: dict) None[source]

Simulate configuring a scan.

Parameters

configuration (dict) – the configuration to be configured

deconfigure_scan() None

Simulate deconfiguring of a scan.

get_subband_data() Dict[int, SubbandMonitorDataType]

Get simulated subband data.

start_scan(**kwargs: Any) None

Simulate start scanning.

Param

the scan arguments.

stop_scan() None

Simulate stop scanning.

class ska_pst.lmc.component.PstSubcomponentManager(*args: Any, **kwargs: Any)[source]

An abstract base sub component manager.

This class is used as a base class for all the PST subcomponents that are managed by the PST BEAM.MGMT TANGO device. For specific components such as RECV.CORE, SMRB.CORE, DSP.DISK, DSP.FT, etc, the sub-component managers should extend from the PstProcessApiSubcomponentManager which uses a process API to manage the core application.

In the case of the DSP sub-components an umbrella DSP subcomponent manager should be used to orchestrate the requests going to a specific sub-component depending on the scan configuration and the observation mode.

abort() None[source]

Abort current process.

The only long lived process for API based devices is that of SCANNING. However, if another system fails this can be used to put all the subsystems into an ABORTED state.

property beam_id: int

Get beam ID for the current subcomponent.

configure_beam(configuration: dict, **kwargs: Any) None[source]

Configure the beam specific configuration of the component.

Parameters

configuration (dict) – configuration for beam

configure_scan(configuration: dict, **kwargs: Any) None[source]

Configure the component for a scan.

Parameters

configuration (dict) – the configuration to be configured

connect() None[source]

Establish connection to API component.

deconfigure_beam() None[source]

Deconfigure the component’s beam configuration.

This will release all the resources associated with the component, including the SMRBs.

deconfigure_scan() None[source]

Deconfigure this component for current scan configuration.

Parameters

task_callback (Callback) – callback for background processing to update device status.

disconnect() None[source]

Establish connection to API component.

end_scan() None[source]

Stop scanning.

go_to_fault(fault_msg: str) None[source]

Set the component into a FAULT state.

For BEAM this will make the sub-devices be put into a FAULT state. For API backed component managers it is expected that the service backing that API should be put into a FAULT state.

property monitoring_polling_rate_ms: int

Get the current monitoring polling rate, in milliseconds.

property obs_state: ska_control_model.ObsState

Get the current observational state of sub-component.

obsreset() None[source]

Reset service.

This is used to reset a service in ABORTED or FAULT states back to an EMPTY state. This will deconfigure a scan and beam.

reset_monitoring() None[source]

Stop monitoring and reset monitoring data.

scan(scan_id: int, **kwargs: Any) None[source]

Start scanning.

The kwargs of this method is scan request. By using the kwargs allow for forward compatability of accepting other parameters for the starting of the scan.

Parameters
  • scan_id (int) – the scan ID

  • kwargs (dict) – scan request as a dict

set_logging_level(log_level: ska_control_model.LoggingLevel) None[source]

Set LoggingLevel.

Parameters

log_level – The required TANGO LoggingLevel

Returns

None.

property simulation_mode: ska_control_model.SimulationMode

Get value of simulation mode state.

Returns

current simulation mode state.

validate_configure_scan(configuration: dict, **kwargs: Any) None[source]

Validate configure scan request with the specific configuration of the component.

Note this is for the whole ConfigureScan request for a PST BEAM component, which includes checking both the beam and scan configuration is correct. This is due to the fact that clients of BEAM.MGMT only exposes a ConfigureScan request as it’s an Obs device.

Parameters

configuration (dict) – the configuration to validate.

ska_pst.lmc.component.as_device_attribute_name(attr_name: str) str[source]

Convert attribute name to a TANGO device attribute name.

Device attribute names should be in lower camel case (i.e. availableDiskSpace) not Python’s snake case (i.e. available_disk_space). This is a utility method that makes the conversion easier.

Parameters

attr_name (str) – the attribute name to convert from snake case.

Returns

the lower camel case version of input string.

Return type

str