Tango event subscription modes
Taurus supports the event subscription modes introduced in Tango 10.1.0. Two aspects are relevant to Taurus clients:
Selecting the event subscription mode (
EventSubMode).A lightweight first read to initialize attribute values when needed.
For background on Tango events and PyTango API see the official docs:
Tango Events and PyTango DeviceProxy API. PyTango exposes the
EventSubMode enum and adds EventReason in the EventData
structure (see documentation in PyTango client API).
EventSubMode in Taurus
Taurus supports all event subscription modes that Tango >= 10.1.0 provides. The Taurus functionality is independent of the selected mode, but application startup performance may vary depending on the attributes and devices involved.
When available, Taurus uses AsyncRead as the default EventSubMode. In
most cases it should not be changed, since AsyncRead provides a good compromise
between compatibility, simplicity, and performance. The mode can be changed when
needed; see Change the Tango event subscription mode.
If you experience problems when starting applications, especially with value
initialization, the mode can be changed to SyncRead to recover the previous
Taurus (< 5.4) default behaviour.
The following table (adapted from PyTango EventSubMode) summarizes the available event subscription modes:
EventSubMode |
Tries subscription before returning |
Raises on subscription failure |
Retries automatically |
Reads entity |
First callback |
|---|---|---|---|---|---|
SyncRead |
Yes |
Yes |
No |
Yes, during subscription |
Immediately, with data |
AsyncRead |
No |
No |
Yes |
Yes, after subscription |
After read, with data |
Sync |
Yes |
Yes |
No |
No |
Not on subscription. Only on next event |
Async |
No |
No |
Yes |
No |
After subscription, no data |
Stateless |
Yes |
No |
Yes |
Yes, during subscription |
Immediately, with data |
First Read (client-side initialization)
Taurus now provides a one-shot read used when the chosen mode does not
perform an initial read by itself (Sync and Async). This first read
is performed asynchronously in a dedicated thread that finishes when
all attributes have been initialized.
This feature ensures that the attribute has a value cached right after subscription setup, delegating to Taurus the responsibility for providing the initial attribute value.
API involved in Taurus:
Factory helper to register a first-time read for a given attribute.
Attribute-side helper that delegates to the factory during initialization.