TMC Common EventReceiver

1. EventReceiver

The event_receiver has the responsibility to receive events from the sub devices managed by a TMC node.

class ska_tmc_common.event_receiver.EventReceiver(component_manager, logger: <Mock id='139757325899216'>, attribute_dict: ~typing.Optional[dict[str, typing.Callable]] = None, max_workers: int = 1, proxy_timeout: int = 500, sleep_time: int = 1)

The EventReceiver class has the responsibility to receive events from the sub devices managed by a TMC node. It subscribes to State, healthState and obsState attribute by default. To subscribe any additional attributes, the class should be sent an attribute_dictionary that contains the attribute names as keys and their handler methods as values.

The Component Manager 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?

start() None

Checks if device is alive

stop() None

Checks if device has stopped

run() None

The run method for the Event Receiver thread. Runs in a loop to subscribe events on the devices.

submit_task(device_info: DeviceInfo) None

Submits the task to the executor for the given device info object.

Parameters:

device_info (DeviceInfo) – DeviceInfo for the device on which events are to be subscribed.

Return type:

None

subscribe_events(dev_info: DeviceInfo, attribute_dictionary: dict[str, Callable]) None

A method to subscribe to attribute events from lower level devices.

Parameters:
  • dev_info (DeviceInfo) – The device info object of the given device.

  • attribute_dictionary (dict[str, Callable]) – A dictionary containing the attributes to subscribe to as keys and their handler functions as values.

Return type:

None

handle_health_state_event(event: tango.EventData) None

It handles the health state events of different devices

handle_state_event(event: tango.EventData) None

It handles the state events of different devices

handle_obs_state_event(event: tango.EventData) None

It handles the observation state events of different devices