Event Serialiser

This module implements an EventSerialiser class for managing events.

class EventSerialiser(logger=None)

A manager class that serialises events and their callbacks in a queue.

This class is intended to be used by parent devices that receive events from child devices. The parent device can queue events and their callbacks to be processed in a separate worker thread. This allows the parent device to ensure serialised executions of callbacks without blocking Tango.

__init__(logger=None)

Create a new EventSerialiser instance.

Parameters:

logger (Optional[Logger]) – The logger to use for logging.

clear_event_history()

Clear the event history.

Return type:

None

property event_history: list[tuple[str, str, Any, str, str, str]]

Return a list of events and their callbacks that have been processed.

Returns:

A list of tuples containing the event and its callback.

queue_event(device_name, event_name, event_value, event_quality, callback)

Queue an event and its callback to be processed in a separate thread.

Parameters:
  • device_name (str) – The name of the device that generated the event.

  • event_name (str) – The name of the event.

  • event_value (Any) – The value of the event.

  • event_quality (AttrQuality) – The quality of the event.

  • callback (Callable) – The callback to call to process the event.

Return type:

None

stop()

Signal the worker to exit, then wait until it finishes.

Putting a None in the queue unblocks ‘_process_events’ if it’s waiting.

Return type:

None