pyebus.prioritizer module

Message Prioritizer.

class pyebus.prioritizer.Prioritizer(msgdefs, thresholds, intervals=3)[source]

Bases: object

Prioritizer which creates recommended message polling priority according to message change interval.

Prio 1 is highest. The number of priorities is defined by the number of thresholds + 1.

Parameters:
  • msgdefs (MsgDefs) – Message Definitions

  • thresholds – Iterable with seconds or timedelta between priority levels.

Keyword Arguments:

intervals – Number of intervals the message update rate need to deviate in a row to get a new prio.

clear()[source]

Clear.

property thresholds

Tuple of timedelta objects with define the time thresholds for each priority.

property maxprio

Maximum Prio.

The number of thresholds + 1.

set_prio(msgdef, prio)[source]

Set Message Priority.

get_prio(msgdef)[source]

Get Message Priority.

iter_priochanges()[source]

Iterate over done priority changes.

Yields

(MsgDef)

notify(msg)[source]

Notify about received message.

Raises:

UnknownMsgError