QueueCapacityChecker¶
-
class
lsst.ts.salobj.topics.
QueueCapacityChecker
(descr, log, queue_len)¶ Bases:
object
Log warnings for a fixed-length queue that should contain no more than one item.
Call
check_nitems
to 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 :
int
orNone
A call to
check_nitems(n)
withn > warn_threshold
will produce a log message and updatewarn_threshold
andreset__threshold
as follows:warn_threshold
is set to the largest warn threshold <= n inwarn_thresholds
, orNone
if the queue is full.reset_threshold
is set to the half of the next lower warning threshold.
- reset_threshold :
int
orNone
A call to
check_nitems(n)
withn < reset_threshold
will reducewarn_threshold
andreset_threshold
as follows:reset_threshold
is set to the largest reset threshold <= n, orNone
if the queue is empty.warn_threshold
is 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 :