ska_tmc_mccssubarrayleafnode.manager package

Link to the TMC User documentation is here.

Submodules

ska_tmc_mccs_subarrayleafnode.manager.component_manager module

Component Manager class for MCCS Subarray Leaf Node

class ska_tmc_mccssubarrayleafnode.manager.component_manager.MccsSLNComponentManager(*args: Any, **kwargs: Any)

Bases: TmcLeafNodeComponentManager

A component manager for The LowTmcLeafNodeMccsSubarray device.

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.

Parameters:

task_callable (TaskCallbackType) – A callable to update the command information.

Returns:

a result code and message

Return type:

Tuple

build_device_attribute_map() Dict[str, List[str]]

Builds a dictionary mapping device names to lists of attributes to be subscribed.

Returns:

A mapping from device names to list of attributes.

Return type:

Dict[str, List[str]]

check_device_responsiveness(device_name: str) bool

This method accepts device_name and provides the responsiveness of the device.

Parameters:

device_name (str) – Tango device FQDN.

Raises:

DeviceNameIncorrect – raises exception when device name is incorrect.

Returns:

Returns True when device is avaiable, else false.

Return type:

bool

clear_command_id_and_mapping(command_class_id: str) None

Method to clear command mapping and resetting command state.

This method handles the common cleanup logic that should be performed at the end of each command’s update_task_status method, including:

  • Clearing the command mapping for the given unique_id

  • Clearing the command_id

  • Clearing the command_in_progress

Parameters:

unique_id (str) – The unique_id to clear from command_mapping

clear_command_mapping(command_class_id: str) None

Clear command mapping for given command_class_id.

configure(argin: str, task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event=None) Tuple[ska_control_model.TaskStatus, str]

Submits the Configure command in the queue for execution.

Parameters:
  • argin (str) – input json string for configure command

  • task_callback – Task Callback

  • task_abort_event (threading.Event) – abort event

Returns:

Tuple of TaskStatus and response.

Return type:

Tuple[TaskStatus, str]

end(task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event=None) Tuple[ska_control_model.TaskStatus, str]

Submits the End command in the queue for execution.

Parameters:
  • task_callback – Task Callback

  • task_abort_event (threading.Event) – abort event

Returns:

Tuple of TaskStatus and response.

Return type:

Tuple[TaskStatus, str]

endscan(task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event=None) Tuple[ska_control_model.TaskStatus, str]

Submits the EndScan command in the queue for execution.

Parameters:
  • task_callback – Task Callback

  • task_abort_event (threading.Event) – abort event

Returns:

Tuple of TaskStatus and response.

Return type:

Tuple[TaskStatus, str]

get_attribute_dict() dict

Method for getting the attributes to be handled by EventManager

Returns:

Dictionary of attributes to be handled by the EventManager.

Return type:

dict

get_command_id(unique_id: str) str | None

Retrieves the command ID for a given unique ID.

Parameters:

unique_id (str) – The unique ID to look up.

Returns:

The command ID associated with the unique ID, or an empty string if not found.

Return type:

str

get_device() ska_tmc_common.SubArrayDeviceInfo

Return the device info of the monitoring loop with name device_name

Returns:

a device info

Return type:

SubArrayDeviceInfo

get_lrcr_result() ska_tango_base.commands.ResultCode

Returns long running command result for command with given command ID

Returns:

Result code for given command ID

Return type:

ResultCode

get_obs_state() ska_tango_base.control_model.ObsState

Get Current device obsState

Returns:

Returns device ObsState

Return type:

ObsState

is_command_allowed(command_name: str) bool

Checks whether the specified command is allowed to be executed on this device.

This method ensures that the device is not in the FAULT or UNKNOWN state before executing the command. It also verifies that all the components needed for the operation are responsive.

Parameters:

command_name (str) – The name of the command to be checked.

Returns:

True if the command is allowed, False otherwise.

Return type:

bool

Raises:

CommandNotAllowed – If the specified command is not allowed.

is_command_allowed_callable(command_name: str) None
Parameters:

command_name (str) – Name for the command for which the is_allowed check need to be applied.

is_scan_completed() bool

A function to check whether Scan Command is completed succesfully.

Returns:

True if scan is completed, False otherwise

Return type:

bool

off()

Method ‘off’ is abstract in class ‘BaseComponentManager’ but is not overridden in child class ‘MccsSLNComponentManager’

on()

Method ‘on’ is abstract in class ‘BaseComponentManager’ but is not overridden in child class ‘MccsSLNComponentManager’

process_event(attribute_name: str) None

Process the given attribute’s event using the data from the event_queues and invoke corresponding process method.

Parameters:

attribute_name (str) – Name of the attribute for which event is to be processed

raise_invalid_obsstate_error(command_name: str) ska_tmc_common.exceptions.InvalidObsStateError

checking the InvalidObsState of Mccs Subarray device

Parameters:

command_name (str) – The name of command

Raises:

InvalidObsStateError – raises along with exception message

register_command_mapping(command_class_id: str, unique_id: str) None

Registers command mapping for given command_class_id and unique_id.

Parameters:
  • command_class_id (str) – command_class_id for which command_mapping needs to be registered

  • unique_id (str) – unique_id to be mapped

restart(task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event=None) Tuple[ska_control_model.TaskStatus, str]

Submits the Restart command in the queue for execution.

Parameters:
  • task_callback – Task Callback

  • task_abort_event (threading.Event) – abort event

Returns:

Tuple of TaskStatus and response.

Return type:

Tuple[TaskStatus, str]

scan(argin: str, task_callback: ska_tango_base.base.TaskCallbackType, task_abort_event=None) Tuple[ska_control_model.TaskStatus, str]

Submits the Scan command in the queue for execution.

Parameters:
  • argin (str) – input json string for scan command

  • task_callback – Task Callback

  • task_abort_event (threading.Event) – abort event

Returns:

Tuple of TaskStatus and response.

Return type:

Tuple[TaskStatus, str]

set_abort_event()

Set Abort and abort flag for running commands

setup_event_subscription() None

Sets up the event subscription after input parameters are updated.

standby()

Method ‘standby’ is abstract in class ‘BaseComponentManager’ but is not overridden in child class ‘MccsSLNComponentManager’

start_communicating()

Method ‘start_communicating’ is abstract in class ‘BaseComponentManager’ but is not overridden in child class ‘ MccsSLNComponentManager’

stop() None

Stops the event manager

stop_communicating()

Method ‘stop_communicating’ is abstract in class ‘BaseComponentManager’ but is not overridden in child class ‘ MccsSLNComponentManager’

stop_scan_tracking() None

Stop scan tracking and clean up resources.

property subarray_id: int

Subarray ID for the subarray device associated with the Leaf Node

Returns:

subarray id

Return type:

int

property tmc_mccs_mln_device_name

Returns the MCCS Master Leaf Node device name

Returns:

the MCCS Master Leaf Node device name

Return type:

str

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_health_state(health_state: ska_control_model.HealthState) None

Update a monitored device health state aggregate the health states available

Parameters:

health_state (HealthState) – health state of the device

update_device_info(device_info: ska_tmc_common.SubArrayDeviceInfo) None

Update the device info used for monitoring.

Parameters:

device_info – Information about the MCCS Subarray 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.DeviceInfo, exception: Exception) None

Mark a device as failed and invoke the corresponding callback if it exists

Parameters:
  • device_info (DeviceInfo) – a device info

  • exception (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_mccs_subarrayleafnode.manager.event_manager module

Event manager class for MccsSLN

class ska_tmc_mccssubarrayleafnode.manager.event_manager.MccsSLNEventManager(*args: Any, **kwargs: Any)

Bases: EventManager

MccsSLNEventManager class inherits from EventManager and adds event callbacks.

adminmode_event_callback(event: tango.EventData) None

It handles the admin mode events of subsystem’s controller and subaray devices.

Parameters:

event_data (tango.EventType.CHANGE_EVENT) – to flag the change in event.

healthstate_event_callback(event: tango.EventData) None

It handles the health state events of subsystem’s controller and subarray devices.

Parameters:

event_data (tango.EventType.CHANGE_EVENT) – to flag the change in event.

longrunningcommandresult_event_callback(event: tango.EventData) None

Callback for longRunningCommandResult attribute.

Delegates to specific handlers based on device type.

Parameters:

event_data (tango.EventType.CHANGE_EVENT) – to flag the change in event.

obsstate_event_callback(event: tango.EventData) None

Handles observation state event.

Parameters:

event_data (tango.EventType.CHANGE_EVENT) – to flag the change in event.

state_event_callback(event: tango.EventData) None

It handles the state events of subsystem’s controller and subaray devices.

Parameters:

event_data (tango.EventType.CHANGE_EVENT) – to flag the change in event.

ska_tmc_mccs_subarrayleafnode.manager.event_manager module

Dataclass representing inputs used to evaluate health state and health info.

class ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSHealthStateAndInfoManager(set_health_state: Callable, set_health_info: Callable, logger)

Bases: object

Manager for MCCS Subarray Leaf Node health data.

evaluate_health_state() ska_control_model.HealthState

Evaluate health state using rules.

Returns:

evaluated health state (never None).

Return type:

HealthState

generate_health_info() Dict

Generate a health info dictionary based on current health data.

Returns:

Health info dictionary.

Return type:

Dict

update_health_data(event_data, data_type) None

Update the health data with new values.

Parameters:

event_data (MCCSLNHealthData) – New health data to update.

update_mccs_subarray_health(event_data) None

Update the MCCS device health data.

Parameters:

event_data (MCCSSubarrayHealthStateData) – MCCS device health data.

update_mccs_subarray_liveliness(event_data: bool) None

Update the MCCS device liveliness data.

Parameters:

event_data (bool) – liveliness data (unresponsive flag)

class ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSSubarrayHealthData(mccs_sub_health_states: ~ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSSubarrayHealthStateData = <factory>, mccs_sub_liveliness: ~ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSSubarrayLivelinessData = <factory>)

Bases: object

Dataclass representing health data for MCCS Subarray Leaf Node.

mccs_sub_health_states: MCCSSubarrayHealthStateData
mccs_sub_liveliness: MCCSSubarrayLivelinessData
class ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSSubarrayHealthStateData(health_state: ska_control_model.HealthState = ska_control_model.HealthState.UNKNOWN)

Bases: object

Dataclass representing health state data for MCCS Subarray Node.

class ska_tmc_mccssubarrayleafnode.manager.health_state_manager.MCCSSubarrayLivelinessData(unresponsive: bool = False)

Bases: object

Dataclass representing liveliness data for MCCS Subarray Node.

unresponsive: bool = False

Module contents

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.