ska_tmc_sdpsubarrayleafnode.manager package
Link to the TMC User documentation is here.
Submodules
ska_tmc_sdpsubarrayleafnode.manager.component_manager module
This module provided a reference implementation of a BaseComponentManager.
It is provided for explanatory purposes, and to support testing of this package.
- class ska_tmc_sdpsubarrayleafnode.manager.component_manager.SdpSLNComponentManager(*args: Any, **kwargs: Any)
Bases:
TmcLeafNodeComponentManagerA component manager for The SDP Subarray Leaf Node component.
It supports:
Monitoring its component, e.g. detect that it has been turned off or on
- abort(task_callback: ska_tango_base.base.TaskCallbackType) Tuple
Aborting the subarray.
- Returns:
a result code and message
- assign_resources(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submit the AssignResources command in queue.
- Returns:
a result code and message
- property assign_resources_schema_version: str
Gets the schema version assigned to resources.
- Returns:
The current value of the assign_resources_schema_version.
- Return type:
str
- cmd_ended_cb(event)
Callback function immediately executed when the asynchronous invoked command returns. Checks whether the command has been successfully invoked on SdpSubarray.
- Parameters:
event – a CmdDoneEvent object. This object is used to passdata to the callback method in asynchronous callback model forcommand execution.
- configure(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Configure command for execution.
- Return type:
tuple
- end(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the End command for execution.
- Return type:
tuple
- end_scan(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the EndScan command for execution.
- Return type:
tuple
- generate_command_result(result_code: ska_tango_base.commands.ResultCode, message: str) Tuple[ska_tango_base.commands.ResultCode, str]
This method is used for generating command result
- get_attribute_dict() dict
- Returns:
Dictionary of attributes to be handled by the EventReceiver.
- get_device() ska_tmc_common.device_info.SubArrayDeviceInfo
Return the device info our of the monitoring loop with name dev_name
- Returns:
a device info
- Return type:
DeviceInfo
- get_obs_state() ska_tango_base.control_model.ObsState
Get Current device obsState
- Returns:
Current device ObsState
- Return type:
ObsState
- is_command_allowed(command_name: str) Union[bool, ska_tmc_common.exceptions.InvalidObsStateError, ska_tmc_common.exceptions.DeviceUnresponsive, ska_tmc_common.exceptions.CommandNotAllowed]
Checks whether this command is allowed It checks that the device is in the right state to execute this command and that all the component needed for the operation are not unresponsive
- Parameters:
command_name (str) – Command to be checked.
- Returns:
True if this command is allowed.
- Return type:
bool
- Raises:
InvalidObsStateError – When device is in invalid ObsState.
CommandNotAllowed – When command is not allowed.
- is_command_allowed_callable(command_name: str)
- Parameters:
command_name (str) – _description_
- property lrc_result: Tuple[str, str]
Returns the longRunningCommandResult attribute.
- Returns:
the longRunningCommandResult
- Return type:
Tuple[str, str]
- off(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Off command for execution.
- Return type:
tuple
- on(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the On command for execution.
- Return type:
tuple
- raise_invalid_obsstate_error(command_name: str) ska_tmc_common.exceptions.InvalidObsStateError
checking the InvalidObsState of SdpSubarray device
- Parameters:
command_name (str) – The name of command
- release_all_resources(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the ReleaseAllResources command for execution.
- Return type:
tuple
- restart(task_callback: Optional[ska_tango_base.base.TaskCallbackType] = None) Tuple[ska_tango_base.executor.TaskStatus, str]
Submit the Restart command in queue.
- Returns:
a result code and message
- scan(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Scan command for execution.
- Return type:
tuple
- standby(task_callback: Optional[Callable] = None) None
Standby command is not implemented by SDP Subarray Leaf Node device.
- 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()
Method used to Stop the liveliness probe and event receiver for given devices.
- 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.
- update_command_result(command_name: str, value: str) None
Updates the long running command result callback
- Parameters:
command_name (str) – Command name
value (str) – longRunningCommandResult value
- update_device_admin_mode(admin_mode: ska_control_model.AdminMode) None
Update a monitored device admin mode, and call the relative callbacks if available
- Parameters:
admin_state – admin mode of the device
- update_device_obs_state(obs_state: ska_tango_base.control_model.ObsState) None
Update a monitored device obs state, and call the relative callbacks if available
- Parameters:
obs_state (ObsState) – obs state of the device
- update_exception_for_unresponsiveness(device_info: ska_tmc_common.device_info.SubArrayDeviceInfo, exception: str) None
Set a device to failed and call the relative callback if available
- Parameters:
device_info (DeviceInfo) – a device info
exception – an exception
- update_responsiveness_info(device_name: str) None
Update a device with the correct availability information.
- Parameters:
dev_name (str) – name of the device
ska_tmc_sdpsubarrayleafnode.manager.event_receiver module
Event Reciever for SDP Subarray Leaf Node Manager
- class ska_tmc_sdpsubarrayleafnode.manager.event_receiver.SdpSLNEventReceiver(*args: Any, **kwargs: Any)
Bases:
EventReceiverThe SdpSLNEventReceiver class has the responsibility to receive events from the sub devices managed by the Sdp Subarray Leaf Node.
The ComponentManager uses the handle events methods for the attribute of interest. For each of them a callback is defined.
- run()
- subscribe_events(dev_info: ska_tmc_common.device_info.SubArrayDeviceInfo, attribute_tobe_subscribed: Optional[List[str]] = None)
Method for subscribing events.
- Parameters:
dev_info (SubArrayDeviceInfo) – Device info.
attribute_tobe_subscribed – Attribute list to be subscribed.
Module contents
Init module for SDP Subarray Leaf Node Manager
- class ska_tmc_sdpsubarrayleafnode.manager.SdpSLNComponentManager(*args: Any, **kwargs: Any)
Bases:
TmcLeafNodeComponentManagerA component manager for The SDP Subarray Leaf Node component.
It supports:
Monitoring its component, e.g. detect that it has been turned off or on
- abort(task_callback: ska_tango_base.base.TaskCallbackType) Tuple
Aborting the subarray.
- Returns:
a result code and message
- assign_resources(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submit the AssignResources command in queue.
- Returns:
a result code and message
- property assign_resources_schema_version: str
Gets the schema version assigned to resources.
- Returns:
The current value of the assign_resources_schema_version.
- Return type:
str
- cmd_ended_cb(event)
Callback function immediately executed when the asynchronous invoked command returns. Checks whether the command has been successfully invoked on SdpSubarray.
- Parameters:
event – a CmdDoneEvent object. This object is used to passdata to the callback method in asynchronous callback model forcommand execution.
- configure(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Configure command for execution.
- Return type:
tuple
- end(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the End command for execution.
- Return type:
tuple
- end_scan(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the EndScan command for execution.
- Return type:
tuple
- generate_command_result(result_code: ska_tango_base.commands.ResultCode, message: str) Tuple[ska_tango_base.commands.ResultCode, str]
This method is used for generating command result
- get_attribute_dict() dict
- Returns:
Dictionary of attributes to be handled by the EventReceiver.
- get_device() ska_tmc_common.device_info.SubArrayDeviceInfo
Return the device info our of the monitoring loop with name dev_name
- Returns:
a device info
- Return type:
DeviceInfo
- get_obs_state() ska_tango_base.control_model.ObsState
Get Current device obsState
- Returns:
Current device ObsState
- Return type:
ObsState
- is_command_allowed(command_name: str) Union[bool, ska_tmc_common.exceptions.InvalidObsStateError, ska_tmc_common.exceptions.DeviceUnresponsive, ska_tmc_common.exceptions.CommandNotAllowed]
Checks whether this command is allowed It checks that the device is in the right state to execute this command and that all the component needed for the operation are not unresponsive
- Parameters:
command_name (str) – Command to be checked.
- Returns:
True if this command is allowed.
- Return type:
bool
- Raises:
InvalidObsStateError – When device is in invalid ObsState.
CommandNotAllowed – When command is not allowed.
- is_command_allowed_callable(command_name: str)
- Parameters:
command_name (str) – _description_
- property lrc_result: Tuple[str, str]
Returns the longRunningCommandResult attribute.
- Returns:
the longRunningCommandResult
- Return type:
Tuple[str, str]
- off(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Off command for execution.
- Return type:
tuple
- on(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the On command for execution.
- Return type:
tuple
- raise_invalid_obsstate_error(command_name: str) ska_tmc_common.exceptions.InvalidObsStateError
checking the InvalidObsState of SdpSubarray device
- Parameters:
command_name (str) – The name of command
- release_all_resources(task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the ReleaseAllResources command for execution.
- Return type:
tuple
- restart(task_callback: Optional[ska_tango_base.base.TaskCallbackType] = None) Tuple[ska_tango_base.executor.TaskStatus, str]
Submit the Restart command in queue.
- Returns:
a result code and message
- scan(argin: str, task_callback: ska_tango_base.base.TaskCallbackType) Tuple[ska_tango_base.executor.TaskStatus, str]
Submits the Scan command for execution.
- Return type:
tuple
- standby(task_callback: Optional[Callable] = None) None
Standby command is not implemented by SDP Subarray Leaf Node device.
- 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()
Method used to Stop the liveliness probe and event receiver for given devices.
- 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.
- update_command_result(command_name: str, value: str) None
Updates the long running command result callback
- Parameters:
command_name (str) – Command name
value (str) – longRunningCommandResult value
- update_device_admin_mode(admin_mode: ska_control_model.AdminMode) None
Update a monitored device admin mode, and call the relative callbacks if available
- Parameters:
admin_state – admin mode of the device
- update_device_obs_state(obs_state: ska_tango_base.control_model.ObsState) None
Update a monitored device obs state, and call the relative callbacks if available
- Parameters:
obs_state (ObsState) – obs state of the device
- update_exception_for_unresponsiveness(device_info: ska_tmc_common.device_info.SubArrayDeviceInfo, exception: str) None
Set a device to failed and call the relative callback if available
- Parameters:
device_info (DeviceInfo) – a device info
exception – an exception
- update_responsiveness_info(device_name: str) None
Update a device with the correct availability information.
- Parameters:
dev_name (str) – name of the device
- class ska_tmc_sdpsubarrayleafnode.manager.SdpSLNEventReceiver(*args: Any, **kwargs: Any)
Bases:
EventReceiverThe SdpSLNEventReceiver class has the responsibility to receive events from the sub devices managed by the Sdp Subarray Leaf Node.
The ComponentManager uses the handle events methods for the attribute of interest. For each of them a callback is defined.
- run()
- subscribe_events(dev_info: ska_tmc_common.device_info.SubArrayDeviceInfo, attribute_tobe_subscribed: Optional[List[str]] = None)
Method for subscribing events.
- Parameters:
dev_info (SubArrayDeviceInfo) – Device info.
attribute_tobe_subscribed – Attribute list to be subscribed.
Command Timeout
The CommandTimeout attribute is introduced to allow updating the timeout value
for commands without requiring a redeployment. This provides flexibility in tuning
the timeout dynamically at runtime based on operational needs.
The CommandTimeOutDefault property is also introduced, which can be used to set
a default timeout value during the deployment phase. This ensures that an initial
timeout value is preconfigured when the component starts for the first time.
Usage
CommandTimeout attribute - Can be updated at runtime without redeployment. - Helps in adapting to varying command execution times.
CommandTimeOutDefault property - Configurable in the deployment configuration (e.g.,
values.yaml). - Sets the initial timeout value at startup.