ska_tmc_subarraynode.manager package
Submodules
aggregators
Path: src/ska_tmc_subarraynode/manager/aggregators.py
- This Module is for Aggregating the HealthState and
ObsStates of Devices
- class ska_tmc_subarraynode.manager.aggregators.HealthStateAggregatorLow(cm, logger)
Bases:
Aggregator
The HealthStateAggregatorLow class is an implementation of an aggregator that is responsible for aggregating the health states of various devices in the low telescope.
- class ska_tmc_subarraynode.manager.aggregators.HealthStateAggregatorMid(cm, logger=<Logger ska_tmc_subarraynode.manager.aggregators (WARNING)>)
Bases:
Aggregator
The HealthStateAggregatorMid class is an implementation of an aggregator that is responsible for aggregating the health states of various devices in the mid telescope
- class ska_tmc_subarraynode.manager.aggregators.ObsStateAggregatorLow(cm, logger)
Bases:
Aggregator
The ObsStateAggregatorLow class is a subclass of the Aggregator class and is responsible for aggregating and managing the observation states of the subarrays
- aggregate()
Calculates aggregated observation state of Subarray.
- class ska_tmc_subarraynode.manager.aggregators.ObsStateAggregatorMid(cm, logger)
Bases:
Aggregator
The ObsStateAggregatorMid class is a subclass of the Aggregator class and is responsible for aggregating and managing the observation states of the subarrays
event_receiver
Path: src/ska_tmc_subarraynode/manager/event_receiver.py
This Module is used to Receive events from devices
- class ska_tmc_subarraynode.manager.event_receiver.SubarrayNodeEventReceiver(component_manager, logger, max_workers=1, proxy_timeout=500, sleep_time=1)
Bases:
EventReceiver
The SubarrayNodeEventReceiver class has the responsibility to receive events from the sub devices managed by the Subarray node.
The ComponentManager uses the handle events methods for the attribute of interest. For each of them a callback is defined.
TBD: what about scalability? what if we have 1000 devices?
- check_event_error(event, callback)
Method for checking event error.
- property device_attribute_event_ids
A property that stores the device names, the attributes they have subscribed to and the corresponding event ids.
- handle_assigned_resources_event(event)
Method for handling assigned resources events.
- handle_dish_mode_event(event)
Method for handling dish mode event.
- handle_lrcr_event(event)
Method for handling longRunningCommandResult events.
- handle_pointing_state_event(event)
Method for handling PointingState event.
- handle_receive_addresses_event(event)
Method for handling and receiving addresses events. and to subscribe to pointing_offsets of sdpqc
- handle_subsystem_availability_event(event_data)
Method for handling isSubarrayAvailable attribute events.
- obs_state_event_callback(event)
Put the obsState event received in a Queue for processing.
- Return type
- set_device_attribute_event_ids(dev_name, attribute_name, event_id)
Stores the value for attribute event id.
- Parameters
dev_name (str) – Device name for which the event id is being stored.
attribute_name (str) – Attribute name for which the event id has to be stored.
event_id (int) – Event id for the event subscription
- Return type
- Returns
None
- subscribe_events(dev_info, attribute_dictionary=None)
Method for subscribing events
- Return type
- subscribe_to_event(device_proxy, attribute_name, event_callback)
Subscribe to the attribute event for the device with provided callback function. If the event is already subscribed to, return. If not, add the entry to the device_attribute_event_ids dictionary, with the subscription id.
- Parameters
device_proxy (tango.DeviceProxy) – Device proxy of the device for which event has to be subscribed to.
attribute_name (str) – Attribute name for which the event has to be subscribed to.
event_callback (Callable[[tango.EventData], None]) – Callback to be used for processing event data
- Return type
- Returns
None
- unsubscribe_dish_leaf_events()
Method for unsubscribing dish leaf events.
subarray_node_component_manager
Path: src/ska_tmc_subarraynode/manager/component_manager.py
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_subarraynode.manager.subarray_node_component_manager.SubarrayNodeComponentManager(op_state_model, obs_state_model, _command_tracker, _input_parameter, logger, _component=None, _update_device_callback=None, _update_subarray_health_state_callback=None, _update_assigned_resources_callback=None, _update_subarray_availability_status_callback=None, _liveliness_probe=True, _event_receiver=True, communication_state_changed_callback=None, component_state_changed_callback=None, command_timeout=30, abort_command_timeout=40, max_workers=5, proxy_timeout=500, sleep_time=1)
Bases:
BaseTmcComponentManager
,SubarrayComponentManager
A component manager for The Subarray Node component.
It supports:
Monitoring its component, e.g. detect that it has been turned off or on
Fetching the latest SCM indicator values of the components periodically and trigger the subarray health state and observation state aggregation
Receiving the change events from the subarray component and trigger the subarray health state and observation state aggregation
- add_device_to_lp(device_name)
Add device to the liveliness probe
- add_multiple_devices(device_list)
Add multiple devices to the liveliness probe
- add_similar_low_mid_device(device_name)
Add Similar Low and Mid device to the liveliness probe
- assign(argin, task_callback)
Submits AssignResources command as a separate task.
- Return type
- Returns
a result code and message
- property assigned_resources
Return the resources assigned to the component.
- check_command_not_allowed_exception(op_state, states_not_allowed, cmd_name)
This method checks command not allowed exception
- check_event_error(event, callback)
Method for checking event error.
- check_for_incremental_assign_and_revise_obsstate()
This method checks for incremental assign resources and evaluates final obsstate
- check_if_sdp_sln_is_available()
Check if the sdp subarray device availability is True.
- Return type
- check_subarray_device_availability()
Checks if the subarray device availability is True if not, raises exception CommandNotAllowed.
- Return type
- check_successive_configure_revise_obsstate()
This method checks for successive configure resources and evaluates final obsstate
- property checked_devices
Return the list of the checked monitored devices
- Returns
list of the checked monitored devices
- clear_assigned_resources()
Clears assigned resources after the aggregation of obsState EMPTY This method is overridden by the child classes. For Mid it clears dish dev names. For low currently no resources are cleared.
- property command_in_progress
Returns the command_in_progress variable :return: command in progress :rtype: str
- component_state_changed_callback_and_logging(callback_action, command_in_progress, aggregated_obsstate)
Method calls component_state_changed_callback to complete aggregate obsState change and logs completion message.
- Parameters
- Type
- Type
str or None
- Type
ObsState
- Return type
- configure(argin, task_callback)
Configure to allocated Subarray device.
- Return type
- Returns
a result code and message
- property devices
Return the list of the monitored devices
- Returns
list of the monitored devices
- end(task_callback)
End the configuration of Subarray.
- Return type
- Returns
a result code and message
- end_scan(task_callback)
End the configuration of Subarray.
- Return type
- Returns
a result code and message
- generate_command_result(result_code, message)
Method for generating command result :param result_code : send result_code :type result_code: int :type message:
str
:param message: message of invoking command- Return type
- get_device(device_name)
Return the device info with device name device_name
- Parameters
device_name (str) – name of the device
- Returns
a device info
- Return type
DeviceInfo
- get_scan_duration()
Returns scan_duration value.
- get_scan_id()
Returns scan_id value.
- get_subarray_healthstate()
Returns value of subarray’s health state.
- Return type
HealthState
- get_subarray_obsstate()
Returns aggregated subarray ObsState
- Return type
ObsState
- property input_parameter
Return the input parameter
- Returns
input parameter
- Return type
- is_command_allowed(command_name)
Checks whether this command is allowed It checks that the device is in a state to perform this command and that all the component needed for the operation are not unresponsive
- Parameters
command_name (str) – name of the command
- Returns
True if this command is allowed, False otherwise
- Return type
boolean
- property is_operation_aborted
Aborted Flag
- property is_partial_configuration
Returns True if the configuration is partial.
- is_scan_timer_running()
Checks if the scan_timer thread is alive.
- off(task_callback)
Submits Off command as a separate task.
- Return type
- Returns
a result code and message
- on(task_callback)
Submits On command as a separate task.
- Parameters
task_callback (TaskCallbackType, optional) – Update task state, defaults to None
- Return type
- Returns
a result code and message
- process_lrcr_event()
Process the obsState events that are present in the Queue.
- process_obs_state_event()
Process the obsState events that are present in the Queue.
- release_all(task_callback)
Submits ReleaseAllResources command as a separate task.
- Return type
- Returns
a result code and message
- remove_devices_from_lp(device_names)
Remove the given devices from liveliness probe.
- Parameters
device_names (List[str]) – Device names for devices to be removed from Liveliness Probe
- Return type
- reset()
Method for resetting Not implemented
- reset_scan_duration()
Reset scan_duration value.
- restart(task_callback)
Restarting the subarray.
- Return type
- Returns
a result code and message
- scan(argin, task_callback)
Scanning the devices.
- Return type
- Returns
a result code and message
- set_assigned_resources(resources)
For SubarrayNode Mid, set assigned_resources with the list of dishes in argin.
- Parameters
resources – name of the dish devices
- set_scan_duration(scan_duration)
Sets scan_duration value.
- Parameters
scan_duration – value to set
- Type
- set_scan_id(scan_id)
Sets scan_id value.
- set_subarray_id(subarray_id)
Sets subarray_id value.
- stop()
Stopping the liveliness probe
- stop_scan_timer()
Stops scan_timer thread.
- property subarray_obsstate
Keeps track of aggregated subarray ObsState
Returns List of the unavailable_devices.
- unsubscribe_dish_events()
Unsubscribes the events for Dishleafnode and Dishmaster
- update_assigned_resources(device_name, assigned_resources)
Update assignedResources for a monitored device
- update_device_dish_mode(device_name, dish_mode)
Update the dish mode for given device.
- Parameters
device_name (str) – name of the device
dish_mode (DishMode) – dish mode of the device
- update_device_health_state(device_name, health_state)
Update a monitored device health state aggregate the health states available
- update_device_obs_state(device_name, obs_state)
Update a monitored device obs state, and call the relative callbacks if available
- Parameters
device_name (str) – name of the device
obs_state (ObsState) – obs state of the device
- update_device_ping_failure(device_info, exception)
Set a device to failed and call the relative callback if available
- update_device_pointing_state(device_name, pointing_state)
Update a monitored device pointing state aggregate the Subarray obs states and Dish pointing states
- Parameters
device_name (str) – name of the device
pointing_state (PointingState) – pointing state of the device
- update_device_state(device_name, state)
Update a monitored device state, aggregate the states available and call the relative callbacks if available
- update_event_failure(device_name)
Update the event failures if any for the given Device.
- update_input_parameter()
Updates the input parameter of a class instance with the current state of the instance.
- Return type
- update_long_running_command_result(dev_name, value)
Stores the longRunningCommandResult values for devices and Updates the long_running_result_callback if the required criteria is met (i.e received events from all the expected devices for a given command).
- Parameters
dev_name (str) – Device name for which the longRunningCommandResult event was received
value (Tuple[str, str]) – longRunningCommandResult event value
- Return type
- Returns
None
- update_ping_info(ping, device_name)
Update a device with correct ping information.
- update_receive_addresses(device_name, receive_addresses)
Update receiveAddresses for a monitored device
- update_subarray_availability_status(device_name, availability_status)
Update a monitored device availability status aggregate the subarray availability
Module contents
Init module for manager
- class ska_tmc_subarraynode.manager.HealthStateAggregatorLow(cm, logger)
Bases:
Aggregator
The HealthStateAggregatorLow class is an implementation of an aggregator that is responsible for aggregating the health states of various devices in the low telescope.
- class ska_tmc_subarraynode.manager.HealthStateAggregatorMid(cm, logger=<Logger ska_tmc_subarraynode.manager.aggregators (WARNING)>)
Bases:
Aggregator
The HealthStateAggregatorMid class is an implementation of an aggregator that is responsible for aggregating the health states of various devices in the mid telescope
- class ska_tmc_subarraynode.manager.ObsStateAggregatorLow(cm, logger)
Bases:
Aggregator
The ObsStateAggregatorLow class is a subclass of the Aggregator class and is responsible for aggregating and managing the observation states of the subarrays
- aggregate()
Calculates aggregated observation state of Subarray.
- class ska_tmc_subarraynode.manager.ObsStateAggregatorMid(cm, logger)
Bases:
Aggregator
The ObsStateAggregatorMid class is a subclass of the Aggregator class and is responsible for aggregating and managing the observation states of the subarrays
- class ska_tmc_subarraynode.manager.SubarrayAvailabilityAggregatorLow(component_manager, logger)
Bases:
Aggregator
Class to aggregate tmc low subarray device availability depending on tmc low leaf nodes
- aggregate()
Aggregates the subarray availability
- class ska_tmc_subarraynode.manager.SubarrayAvailabilityAggregatorMid(component_manager, logger)
Bases:
Aggregator
class to aggregate tmc mid subarray device availability depending on tmc mid leaf nodes
- class ska_tmc_subarraynode.manager.SubarrayNodeComponentManagerLow(op_state_model, obs_state_model, _command_tracker, _input_parameter, logger=None, _component=None, _liveliness_probe=True, _event_receiver=True, component_state_changed_callback=None, communication_state_changed_callback=None, _update_device_callback=None, _update_subarray_health_state_callback=None, _update_assigned_resources_callback=None, _update_subarray_availability_status_callback=None, command_timeout=30, abort_command_timeout=40, max_workers=5, proxy_timeout=500, sleep_time=1)
Bases:
SubarrayNodeComponentManager
Initialise a new ComponentManager instance for low.
- add_device_to_lp(device_name)
Add device to the liveliness probe
- check_successive_configure_revise_obsstate()
This method checks for successive configure resources and evaluates final obsstate
- property configured_capabilities
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- deconfigure()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- get_devices_availability_dict()
Returns the dictionary with the devices and it’s availabiltiy
- obsreset()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- release()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- standby()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- start_communicating()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- stop_communicating()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- update_long_running_command_result(dev_name, value)
Stores the longRunningCommandResult values for devices and Updates the long_running_result_callback if the required criteria is met (i.e received events from all the expected devices for a given command).
- Parameters
dev_name (str) – Device name for which the longRunningCommandResult event was received
value (Tuple[str, str]) – longRunningCommandResult event value
- Return type
- Returns
None
- class ska_tmc_subarraynode.manager.SubarrayNodeComponentManagerMid(op_state_model, obs_state_model, _command_tracker, _input_parameter, logger=None, _component=None, _liveliness_probe=True, _event_receiver=True, component_state_changed_callback=None, communication_state_changed_callback=None, _update_device_callback=None, _update_subarray_health_state_callback=None, _update_assigned_resources_callback=None, _update_subarray_availability_status_callback=None, command_timeout=30, abort_command_timeout=40, max_workers=5, proxy_timeout=500, sleep_time=1)
Bases:
SubarrayNodeComponentManager
Initialise a new ComponentManager instance for mid.
- add_device_to_lp(device_name)
Add device to the liveliness probe
- clear_assigned_resources()
Removes Dish Leaf Node and Dish Master devices from Input Parameter
- Return type
- property configured_capabilities
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- deconfigure()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- get_devices_availability_dict()
Returns the dictionary with the devices and it’s availabiltiy
- get_keys_required_for_getting_sdpqc_fqdn()
Returns the keys that are required to get sdpqc fqdn from dictionary received from SDP subarray receivedAddresses attribute at runtime
- Return type
- get_tmc_dish_ln_device_names()
Return the names of the dish leaf nodes assigned to Subarray
- invoke_pointing_calibration(event_attribute_value)
This method subscribes to the pointing_offsets attribute gathers the required pointing calibration data and invokes TrackLoadStaticOff command.
- Parameters
event_attribute_value (string) – receiveAddresses attribute value
- Return type
- obsreset()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- property pointing_calibrations
Gives the current pointing calibrations informed by SDP Queue Connector device.
- release()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- set_dish_device_names(dish_dev_names)
Update the names of the dishes assigned to Subarray
- set_keys_required_for_getting_sdpqc_fqdn(set_the_keys)
Set the values that are required to get sdpqc fqdn from dictionary received from SDP subarray receivedAddresses attribute at runtime
- Return type
- set_tmc_leaf_dish_device_names(tmc_dish_ln_device_names)
Update the names of the dish leaf nodes assigned to Subarray
- Parameters
tmc_dish_ln_device_names (
List
) – name of the dish devices
- standby()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- start_communicating()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- stop_communicating()
This method serves as a placeholder to address linting warnings or errors related to missing or unused functions. It is intentionally left empty to satisfy linting requirements without affecting the program’s behavior.
- class ska_tmc_subarraynode.manager.SubarrayNodeEventReceiver(component_manager, logger, max_workers=1, proxy_timeout=500, sleep_time=1)
Bases:
EventReceiver
The SubarrayNodeEventReceiver class has the responsibility to receive events from the sub devices managed by the Subarray node.
The ComponentManager uses the handle events methods for the attribute of interest. For each of them a callback is defined.
TBD: what about scalability? what if we have 1000 devices?
- check_event_error(event, callback)
Method for checking event error.
- property device_attribute_event_ids
A property that stores the device names, the attributes they have subscribed to and the corresponding event ids.
- handle_assigned_resources_event(event)
Method for handling assigned resources events.
- handle_dish_mode_event(event)
Method for handling dish mode event.
- handle_lrcr_event(event)
Method for handling longRunningCommandResult events.
- handle_pointing_state_event(event)
Method for handling PointingState event.
- handle_receive_addresses_event(event)
Method for handling and receiving addresses events. and to subscribe to pointing_offsets of sdpqc
- handle_subsystem_availability_event(event_data)
Method for handling isSubarrayAvailable attribute events.
- obs_state_event_callback(event)
Put the obsState event received in a Queue for processing.
- Return type
- set_device_attribute_event_ids(dev_name, attribute_name, event_id)
Stores the value for attribute event id.
- Parameters
dev_name (str) – Device name for which the event id is being stored.
attribute_name (str) – Attribute name for which the event id has to be stored.
event_id (int) – Event id for the event subscription
- Return type
- Returns
None
- subscribe_events(dev_info, attribute_dictionary=None)
Method for subscribing events
- Return type
- subscribe_to_event(device_proxy, attribute_name, event_callback)
Subscribe to the attribute event for the device with provided callback function. If the event is already subscribed to, return. If not, add the entry to the device_attribute_event_ids dictionary, with the subscription id.
- Parameters
device_proxy (tango.DeviceProxy) – Device proxy of the device for which event has to be subscribed to.
attribute_name (str) – Attribute name for which the event has to be subscribed to.
event_callback (Callable[[tango.EventData], None]) – Callback to be used for processing event data
- Return type
- Returns
None
- unsubscribe_dish_leaf_events()
Method for unsubscribing dish leaf events.