TopicCallback

class lsst.ts.watcher.TopicCallback(topic, rule, model)

Bases: object

Call rules and/or wrapper callbacks when a topic receives data.

Parameters:
topicsalobj.ReadTopic

Topic to monitor.

ruleBaseRule or None

Rule to call, or None if none. The rule is called with two keyword arguments:

  • data: the new data

  • topic_callbacck: this instance

modelModel

Watcher model. Used by __call__ to check if the model is enabled.

Attributes:
rulesdict

Dict of rule name: rule.

topic_wrappers:

List of topic wrappers.

modelModel

The Watcher model.

topic_keytuple

The topic key computed by get_topic_key.

call_eventasyncio.Event

An event that is set whenever this topic callback’s __call__ method finishes normally (without raising an exception). Intended for unit tests, which may clear this event and then wait for it to be set.

Attributes Summary

attr_name

Get the topic name, with an evt_ or tel_ prefix.

remote_index

Get the SAL index of the remote.

remote_name

Get the name of the remote.

Methods Summary

__call__(data)

Call self as a function.

add_rule(rule)

Add a rule.

add_topic_wrapper(wrapper)

Add a topic wrapper, or other non-rule callable.

Attributes Documentation

attr_name

Get the topic name, with an evt_ or tel_ prefix.

This is the name of the wrapped topic attribute in RemoteWrapper.

remote_index

Get the SAL index of the remote.

remote_name

Get the name of the remote.

Methods Documentation

async __call__(data: BaseMsgType) None

Call self as a function.

add_rule(rule: BaseRule) None

Add a rule.

Parameters:
ruleBaseRule

Rule to add.

add_topic_wrapper(wrapper)

Add a topic wrapper, or other non-rule callable.

Parameters:
wrappercallable

A TopicWrapper or other function that will be called with two keyword arguments:

  • data: the new data

  • topic_callbacck: this instance

Wrapper callbacks are called before rule callbacks.