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)
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.
- subarray_node_obstate_not_aggregated()
the subarray’s obsState is not yet aggregated due to missing events.
- 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
- aggregate()
Calculates aggregated observation state of Subarray.
- subarray_node_obstate_not_aggregated()
the subarray’s obsState is not yet aggregated due to missing events.
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(*args, **kwargs)
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)
Method for checking event error.
- handle_assigned_resources_event(event)
Method for handling assigned resources events.
- handle_csp_leaf_obs_state_event(event)
Handle the CSP Leaf Node obsState event.
- Parameters
event (tango.ChangeEvent) – Event data
- handle_dish_mode_event(event)
Method for handling dish mode event.
- handle_lrcr_event(event)
Method for handling longRunningCommandResult events.
- handle_mccs_leaf_obs_state_event(event)
Handle the MCCS Subarray Leaf Node obsState event.
- Parameters
event (tango.ChangeEvent) – Event data
- 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_sdp_leaf_obs_state_event(event)
Handle the SDP Leaf Node obsState event.
- Parameters
event (tango.ChangeEvent) – Event data
- handle_subsystem_availability_event(event_data)
Method for handling isSubarrayAvailable attribute events.
- subscribe_events(dev_info, attribute_dictionary=None)
Method for subscribing events
- Return type
- unscubscribe_dish_health(dish_proxy, event_id)
Method for unsubscribing dish health
- unscubscribe_dish_leaf_health(dish_leaf_proxy, event_id)
Method for unsubscribing dish leaf health
- unscubscribe_dish_leaf_state(dish_leaf_proxy, event_id)
Method for unsubscribing dish leaf health.
- unscubscribe_dish_mode(dish_proxy, event_id)
Method for unsubscribing dishmode event
- unscubscribe_dish_pointing(dish_proxy, evt_id)
Method for unsubscribing dish pointing
- unscubscribe_dish_state(dish_proxy, event_id)
Method for unsubscribing dish state
- 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, max_workers=5, proxy_timeout=500, sleep_time=1, *args, **kwargs)
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
- abort(task_callback=None)
Aborting the subarray.
- Return type
- Returns
a result code and message
- 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=None)
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_for_incremental_assign_and_revise_obsstate()
This method checks for incremental assign resources and evaluates final obsstate
- check_if_no_dishes_available()
Checks if any dishes are available, if not raises exception CommandNotAllowed.
- Return type
- 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
- 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.
- Return type
- Parameters
callback_action (
Union
[list
,Dict
]) – contains details required by component state changed callback and log statement.
:type dict or list :type command_in_progress:
Optional
[str
] :param command_in_progress: name of command in progress :type str or None :type aggregated_obsstate:ObsState
:param aggregated_obsstate: obsstate aggregated from subsystem obsstate values. :type: ObsState
- configure(argin, task_callback)
Configure to allocated Subarray device.
- Return type
- Returns
a result code and message
- device_failed(device_info, exception)
Set a device to failed and call the relative callback if available
- property devices
Return the list of the monitored devices
- Returns
list of the monitored devices
- end(task_callback=None)
End the configuration of Subarray.
- Return type
- Returns
a result code and message
- end_scan(task_callback=None)
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_info_by_name(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_partial_configuration
Returns True if the configuration is partial.
- is_scan_timer_running()
Checks if the scan_timer thread is alive.
- off(task_callback=None)
Submits Off command as a separate task.
- Return type
- Returns
a result code and message
- on(task_callback=None)
Submits On command as a separate task.
- Parameters
task_callback (Callable, optional) – Update task state, defaults to None
- Return type
- Returns
a result code and message
- release_all(task_callback=None)
Submits ReleaseAllResources command as a separate task.
- Return type
- Returns
a result code and message
- reset()
Method for resetting Not implemented
- reset_scan_duration()
Reset scan_duration value.
- reset_sdp_csp_event_count(command_in_progress_id)
reset count function to reset sdp and csp events count and error dictionary
- Return type
- restart(task_callback=None)
Restarting the subarray.
- Return type
- Returns
a result code and message
- scan(argin, task_callback=None)
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. :type resources: :param resources: name of the dish devices :type list: list[str]
- set_sb_id(sb_id)
Sets sb_id value.
- Parameters
sb_id – value to set
:type float
- set_scan_duration(scan_duration)
Sets scan_duration value.
- Parameters
scan_duration – value to set
:type float
- set_scan_id(scan_id)
Sets scan_id value. :rtype:
None
- Parameters
scan_id (
float
) – value to set
:type float
- set_subarray_id(subarray_id)
Sets subarray_id value. :rtype:
None
- Parameters
sb_id – value to set
:type float
- stop()
Stopping the liveliness probe
- stop_scan_timer()
Stops scan_timer thread.
- subarray_availability_check()
A method to submit aggregation call for subarray availability attribute
- Return type
- property subarray_obsstate
Keeps track of aggregated subarray ObsState
- 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_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)
Updates the long running command result callback
- Return type
- 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
- update_subarray_node_obsstate(device_name, value, attribute_type)
update subarray node obsstate
- Return type