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:
AggregatorThe 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:
AggregatorThe 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.ObsStateAggregator(obs_state_rules)
Bases:
objectNew Aggregator class for Mid
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, event_subscription_check_period=1)
Bases:
EventReceiverThe 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?
- admin_mode_event_callback(event)
Put the adminMode event received in a Queue for processing
- Return type
- 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_health_state_event(event)
It handles the health state events of different devices
- Return type
- 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_tobe_subscribed=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 SubarrayComponentManager inheritted from BaseComponentManager.
- class ska_tmc_subarraynode.manager.subarray_node_component_manager.SubarrayNodeComponentManager(op_state_model, obs_state_model, _command_tracker, _input_parameter, dev_family, logger, _update_device_callback, _update_subarray_health_state_callback, _update_assigned_resources_callback, _update_subarray_availability_status_callback, component_state_changed_callback, _component=None, _liveliness_probe=True, _event_receiver=True, command_timeout=30, abort_command_timeout=40, proxy_timeout=500, event_subscription_check_period=1, liveliness_check_period=1, csp_assign_interface='', csp_scan_interface='', sdp_scan_interface='', jones_uri='')
Bases:
BaseTmcComponentManager,SubarrayComponentManagerA 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 and receiving change events of the components periodically 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
- aggregate_process_monitor()
This method keep tracking aggregate obs state changed from aggregation process
- 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(command_in_progress_id, device_events, error_dict)
This method checks for incremental assign resources and evaluates final obsstate :type command_in_progress_id:
str:param command_in_progress_id: command in progress id :type command_in_progress_id: str :type device_events:dict:param device_events: events for each device :type device_events: dict :type error_dict:dict:param error_dict: error dict :type error_dict: dict :return: ObsState :rtype: 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(command_in_progress_id, device_events, error_dict)
This method checks for successive configure resources and evaluates final obsstate :type command_in_progress_id:
str:param command_in_progress_id: command in progress id :type command_in_progress_id: str :type device_events:dict:param device_events: events for each device :type device_events: dict :type error_dict:dict:param error_dict: error dict :type error_dict: dict :return: ObsState :rtype: 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.
- command_allowed_callable(command_name)
This method provides callable for is_cmd_allowed parameter set while submitting the task :type command_name:
str:param command_name: Tango Device Command Name :type command_name: str
- 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
- end_singular_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_completed()
A function to check whether Scan Command is completed succesfully.
- is_scan_timer_running()
Checks if the scan_timer thread is alive.
- log_state(msg='Device States')
Logs the state of devices and dishes.
This method logs the observation states of generic devices and
the pointing states of dish devices.
- 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_event(attribute_name)
Process the given attribute’s event using the data from the event_queues and invoke corresponding process method.
- 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_admin_mode(argin, task_callback)
set the admin mode of subarray devices :rtype:
Tuple:return: 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_pattern_scan_data(group_list)
This method set pattern scan data. Override this method to set pattern scan data provided in configure
- 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_aggregation_process()
Override this method in mid and low
- stop_all_process()
This stop aggregation process
- 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_admin_mode(device_name, admin_mode, timestamp)
Update a monitored device admin mode
- Parameters
device_name (str) – name of the device
admin_mode (AdminMode) – admin mode of the device
- update_device_dish_mode(device_name, dish_mode, timestamp)
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, timestamp)
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_pointing_state(device_name, pointing_state, timestamp)
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_exception_for_unresponsiveness(device_info, exception)
Set a device to failed and call the relative callback if available
- 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, timestamp)
Abstract method for processing LongRunningCommandResult events.
- Return type
- update_receive_addresses(device_name, receive_addresses)
Update receiveAddresses for a monitored device
- update_responsiveness_info(device_name)
Update a device with correct ping information.
Module contents
Init module for manager
- class ska_tmc_subarraynode.manager.AggregationProcessLow(event_data_queue, aggregated_obs_state, aggregate_update_event, callback=None)
Bases:
AggregationProcessAggregation Process for Low
- class ska_tmc_subarraynode.manager.AggregationProcessMid(event_data_queue, aggregated_obs_state, aggregate_update_event, callback=None)
Bases:
AggregationProcessAggregation Process for Mid
- class ska_tmc_subarraynode.manager.EventDataManager(component_manager)
Bases:
object- A class to update the values of events received for different
attributes in EventDataStorage class
- clear_dish_data()
clear dish data from event info
- clear_lrcr()
clears LongRunning Command Results
- compare_timevals(current_timestamp, received_timestamp)
- A method to compare the timestamps of events received with the
existing timestamp.
- get_enum_name_from_value(enum_class, value)
Get the name from value of enum
- update_aggragation_queue()
- A method to put a copy of the EventDataStorage object whenever
it receives an event.
- update_event_data(device, data, data_type, received_timestamp=None)
A method to receive and update device name, data, and timestamp in the EventDataStorage Class
- class ska_tmc_subarraynode.manager.HealthStateAggregatorLow(cm, logger)
Bases:
AggregatorThe 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:
AggregatorThe 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.SubarrayAvailabilityAggregatorLow(component_manager, logger)
Bases:
AggregatorClass 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:
Aggregatorclass 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, dev_family, component_state_changed_callback, _update_device_callback, _update_subarray_health_state_callback, _update_assigned_resources_callback, _update_subarray_availability_status_callback, update_scan_duration_callback, logger=None, _component=None, _liveliness_probe=True, _event_receiver=True, command_timeout=30, abort_command_timeout=40, proxy_timeout=500, event_subscription_check_period=1, liveliness_check_period=1, csp_assign_interface='https://schema.skao.int/ska-low-csp-assignresources/3.0', csp_scan_interface='https://schema.skao.int/ska-low-csp-scan/0.0', sdp_scan_interface='https://schema.skao.int/ska-sdp-scan/0.4', mccs_configure_interface='https://schema.skao.int/ska-low-mccs-configure/1.0', mccs_scan_interface='https://schema.skao.int/ska-low-mccs-scan/3.0', jones_uri='tango://jones.skao.int/low/stn-beam/1')
Bases:
SubarrayNodeComponentManagerInitialise a new ComponentManager instance for low.
- add_device_to_lp(device_name)
Add device to the liveliness probe
- check_successive_configure_revise_obsstate(command_in_progress_id, device_events, error_dict)
This method checks for successive configure resources and evaluates final obsstate :type command_in_progress_id:
int:param command_in_progress_id: command in progress id :type command_in_progress_id: str :type device_events:dict:param device_events: events for each device :type device_events: dict :type error_dict:dict:param error_dict: error dict :type error_dict: dict :return: ObsState :rtype: 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_aggregation_process()
Stop aggregation process
- 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, timestamp)
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, dev_family, component_state_changed_callback, _update_device_callback, _update_subarray_health_state_callback, _update_assigned_resources_callback, _update_subarray_availability_status_callback, update_scan_duration_callback, logger=None, _component=None, _liveliness_probe=True, _event_receiver=True, command_timeout=30, abort_command_timeout=40, proxy_timeout=500, event_subscription_check_period=1, liveliness_check_period=1, csp_assign_interface='https://schema.skao.int/ska-csp-assignresources/2.0', csp_scan_interface='https://schema.skao.int/ska-csp-scan/2.0', sdp_scan_interface='https://schema.skao.int/ska-sdp-scan/0.4')
Bases:
SubarrayNodeComponentManagerInitialise 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_normal_scan_dish_device_names()
Get normal scan dishln device names
- get_tmc_dish_ln_device_names()
Return the names of the dishes assigned to Subarray
- get_trajectory_dish_device_names()
Get Trajectory dishln device names
- invoke_pointing_calibration(event_attribute_value)
This method get sdpQueueConnectorFqdn from event attribute value and set on dish leaf node :type event_attribute_value: :param event_attribute_value: receiveAddresses attribute value :type event_attribute_value: string
- Return type
- property kvalue_validation_failed
Gives the bool value for kvalue validation result
- 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.
- process_lrcrevent(dev_name, value, timestamp)
Process Long Running Command Result
- 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_normal_scan_dish_device_names(dish_ln_names)
Update the normal scan dishln device names :type dish_ln_names:
List:param dish_ln_names: dish leaf node name list :type dish_ln_names: list
- set_pattern_scan_data(group_list)
Set up Pattern scan data
- 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
- set_trajectory_dish_device_names(dish_ln_names)
Update the trajectory dishln device names :type dish_ln_names:
List:param dish_ln_names: dish leaf node name list :type dish_ln_names: list
- 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_aggregation_process()
Stop aggregation process
- 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, timestamp)
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.SubarrayNodeEventReceiver(component_manager, logger, max_workers=1, proxy_timeout=500, event_subscription_check_period=1)
Bases:
EventReceiverThe 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?
- admin_mode_event_callback(event)
Put the adminMode event received in a Queue for processing
- Return type
- 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_health_state_event(event)
It handles the health state events of different devices
- Return type
- 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_tobe_subscribed=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.