CbfComponentManager Class

class ska_mid_cbf_tdc_mcs.component.component_manager.CbfComponentManager(*args: Any, **kwargs: Any)[source]

Bases: TaskExecutorComponentManager

A base component manager for SKA Mid.CBF MCS

This class exists to modify the interface of the ska_tango_base.executor.executor_component_manager.TaskExecutorComponentManager. The TaskExecutorComponentManager accepts max_queue_size keyword argument to determine limits on worker queue length, for the management of SubmittedSlowCommand (LRC) threads.

Additionally, this provides optional arguments for attribute change event and HealthState updates, for a device to pass in its callbacks for push change events.

Finally, the TaskExecutorComponentManager inherits from BaseComponentManager, which accepts the keyword arguments communication_state_callback and component_state_callback, each with an analogous callback method in the SKABaseDevice (namely _communication_state_changed and _component_state_changed) used to drive the operational state (opState) model from the component manager.

start_communicating(current_admin_mode: AdminMode, admin_mode: AdminMode) None[source]

Establish communication with the component, then start monitoring.

stop_communicating(current_admin_mode: AdminMode, admin_mode: AdminMode) None[source]

Stop communication with the component

task_abort_event_is_set(command_name: str, task_callback: Callable, task_abort_event: Event) bool[source]

Helper method for checking task abort event during command thread.

Parameters:
  • command_name – name of command for result message

  • task_callback – command tracker update_command_info callback

  • task_abort_event – task executor abort event

Returns:

True if abort event is set, otherwise False

create_group_proxies(group_proxies: dict) bool[source]

Create group proxies (list of DeviceProxy) from the list of FQDNs passed in. Store as class attributes. :param :return: True if the group proxies are successfully created, False otherwise.

issue_group_command(command_name: str, proxies: list[tango.DeviceProxy], max_workers: int, argin: any | None = None) list[any][source]

Helper function to perform tango.Group-like threaded command issuance. Returns list of command results in the same order as the input proxies list. If any command causes a tango.DevFailed exception, the result code for that device’s return value will be ResultCode.FAILED.

Important note: all proxies provided must be of the same device type.

For fast commands, the return value will a list of ResultCode and message string tuples. For Long Running Commands, the return value will be a list of ResultCode and unique command ID tuples.

Parameters:
  • command_name – name of command to be issued

  • proxies – list of device proxies in group; determines ordering of return values

  • argin – optional command argument, defaults to None

  • max_workers – maximum number of PyTangoThreadPoolExecutor workers

Returns:

list of proxy command returns

update_device_health_state(health_state: HealthState) None[source]

Handle a health state change. This is a helper method for use by subclasses.

Parameters:

health_state – the new health state of the component manager.

results_callback(event_data: tango.EventData | None) None[source]

Callback for LRC command result events. All subdevices that may block our LRC thread with their own LRC execution have their longRunningCommandResult attribute subscribed to with this method as the change event callback.

Parameters:

event_data – Tango attribute change event data

op_state_callback(event_data: tango.EventData | None) None[source]

Callback for state attribute events.

Parameters:

event_data – Tango attribute change event data

wait_for_blocking_results(task_abort_event: Event | None = None, partial_success: bool = False, lrc_timeout: int | None = None) TaskStatus[source]

Wait for the number of anticipated results to be pushed by subordinate devices.

When issuing an LRC (or multiple) on subordinate devices from an LRC thread, command result events will be stored in self._results_queue; use this method to wait for all blocking command ID longRunningCommandResult events.

All subdevices that may block our LRC thread with their own LRC execution have the results_callback method above provided as the change event callback for their longRunningCommandResult attribute subscription, which will store command IDs and results as change events are received.

Parameters:
  • task_abort_event – Check for abort, defaults to None

  • partial_success – set to True if we only need at least 1 of the blocking LRCs to be successful; defaults to False, in which case all LRCs must succeed

  • lrc_timeout – timeout in seconds. Use device default value if not provided.

Returns:

TaskStatus.COMPLETED if status reached, TaskStatus.FAILED if timed out TaskStatus.ABORTED if aborted

wait_for_blocking_states(target_state: tango.DevState, task_abort_event: Event | None = None) bool[source]

Wait for the number of anticipated state changes to be pushed by subordinate devices.

Parameters:
  • target_state – target state to wait for in all monitored op states

  • task_abort_event – Check for abort, defaults to None

Returns:

True if all state changes were successfully recorded, otherwise False

attr_event_subscribe(proxy: tango.DeviceProxy, attr_name: str, callback: Callable, stateless: bool = True) None[source]

Subscribe to a given proxy’s attribute.

Parameters:
  • proxy – DeviceProxy

  • attr_name – name of attribute for change event subscription

  • callback – change event callback

  • stateless – If False, an exception will be thrown if the event subscription encounters a problem; if True, the event subscription will always succeed, even if the corresponding device server is not running

unsubscribe_all_events(proxy: tango.DeviceProxy) None[source]

Unsubscribe from a proxy’s longRunningCommandResult attribute.

Parameters:

proxy – DeviceProxy

property is_communicating: bool

Return whether communication with the component is established.

SKA Mid.CBF MCS uses the more expressive communication_status for this, but this is still needed as a base classes hook.

Returns:

True if communication with the component is established, else False.

property power_state: PowerState | None

Return the power state of this component manager.

Returns:

the power state of this component manager, if known.

property faulty: bool | None

Return whether this component manager is currently experiencing a fault.

Returns:

True if this component manager is currently experiencing a fault, else False.

The MCS contains two types of Tango devices: observing and non-observing. Non-observing devices contain only an op_state_model while observing devices contain both an op_state_model and obs_state_model. As shown in the inheritance diagram below, non-observing devices inherit from CbfComponentManager while observing devices inherit from CbfComponentManager and CspObsComponentManager.

../../_images/component-manager-inheritance.png