Attribute Polling Component Manager
This module implements a generic attribute polling component manager.
- class AttrInfo(attr_args, polling_period)
Base class for dynamic attribute metadata.
- Parameters:
- __init__(attr_args, polling_period)
- class AttrPollRequest(writes, reads)
Helper class to hold read/write requests passed to the poller.
- __init__(writes, reads)
- class AttributePollingComponentManager(logger, communication_state_callback, component_state_callback, attributes, poll_rate)
An implementation of the attribute polling component manager.
- __init__(logger, communication_state_callback, component_state_callback, attributes, poll_rate)
- enqueue_write(attr_name, val)
Queue an attribute value to be written on the next poll.
If there is already a write pending for the attribute, it will be superseded.
- from_python(attr_name, val)
Convert from raw Python type to a hardware-compatible type.
This is called in enqueue_write() so that any conversion error happens early, when an attribute is set, rather than in the polling thread.
- get_request()
Assemble a list of ObjectTypes representing pending writes and reads.
The writes appear first, and come from self._pending_writes. Reads are requested for each attribute whose last successful poll happened longer ago than its polling period and the polling period is not zero, and each attribute being written.
- Return type:
- Returns:
a list of attributes that should be polled next.
- poll(poll_request)
Group by writes and reads, chunk, and run the appropriate SNMP command.
Aggregate any returned ObjectTypes from GET commands as the poll response.
- Parameters:
poll_request (
AttrPollRequest) – group of read & write attribute requests to poll- Raises:
NotImplementedError – up to the subclass
- Return type:
- poll_failed(exception)
Set PowerState.UNKNOWN when polling fails.
This is a bug fix that should be upstreamed to ska-tango-base once we are confident it works.