QueueCapacityChecker¶
-
class
lsst.ts.salobj.topics.QueueCapacityChecker(descr, log, queue_len)¶ Bases:
objectLog warnings for a fixed-length queue that should contain no more than one item.
Call
check_nitemsto check the number of items in the queue. This will log a warning or error, if appropriate.Parameters: - descr :
str Brief description of queue, e.g. “python read queue” or “DDS read queue”.
- log :
logging.Logger Logger to which to write messages.
- queue_len :
int Length of queue
Notes
Once a message has been logged for a particular threshold, no more messages are sent until either the queue fills enough to cross the next warning threshold or empties enough to reduce the warning threshold.
Log messages are warnings unless the queue is full. A full queue produces an error because data is likely to have been lost.
Attributes: - warn_thresholds :
List[int] Values for
warn_threshold(see next item). Set to:- 5-10 elements, whichever is closest to
queue_len/10 - 1/2 full, but only if
queue_len >= 20 - 9/10 full
- full
The corresponding reset thresholds are 1/2 these values.
- 5-10 elements, whichever is closest to
- warn_threshold :
intorNone A call to
check_nitems(n)withn > warn_thresholdwill produce a log message and updatewarn_thresholdandreset__thresholdas follows:warn_thresholdis set to the largest warn threshold <= n inwarn_thresholds, orNoneif the queue is full.reset_thresholdis set to the half of the next lower warning threshold.
- reset_threshold :
intorNone A call to
check_nitems(n)withn < reset_thresholdwill reducewarn_thresholdandreset_thresholdas follows:reset_thresholdis set to the largest reset threshold <= n, orNoneif the queue is empty.warn_thresholdis set to the warning threshold corresponding to one reset higher reset level.
Methods Summary
check_nitems(nitems)Check the number of items in the queue and log a message if appropriate. Methods Documentation
- descr :