TopicCallback#

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

Bases: object

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

Parameters:
  • topic (salobj.ReadTopic) – Topic to monitor.

  • rule (BaseRule 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

  • model (Model) – Watcher model. Used by __call__ to check if the model is enabled.

rules#

Dict of rule name: rule.

Type:

dict

topic_wrappers#

List of topic wrappers.

model#

The Watcher model.

Type:

Model

topic_key#

The topic key computed by get_topic_key.

Type:

tuple

call_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.

Type:

asyncio.Event

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)#

Call self as a function.

Parameters:

data (BaseMsgType)

Return type:

None

add_rule(rule)#

Add a rule.

Parameters:

rule (BaseRule) – Rule to add.

Return type:

None

add_topic_wrapper(wrapper)#

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

Parameters:
  • wrapper (callable) –

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

    • data: the new data

    • topic_callbacck: this instance

  • callbacks. (Wrapper callbacks are called before rule)