TopicCallback

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

Bases: object

Call one or more rules when a salobj topic receives a sample.

The rule is called with one argument: this topic callback.

Parameters
topicsalobj.ReadTopic

Topic to monitor.

ruleBaseRule or None

Rule to call, or None if none.

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.

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__(value)

Call self as a function.

add_rule(rule)

Add a rule.

add_topic_wrapper(wrapper)

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

get()

Get the current value of the topic.

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__(value)

Call self as a function.

add_rule(rule)

Add a rule.

Parameters
ruleBaseRule

Rule to add.

add_topic_wrapper(wrapper)

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

The callable is called with a single variable: this TopicCallback.

Wrapper callbacks are called before rule callbacks.

get()

Get the current value of the topic.

This is provided so that code in Rule.__call__ can easily get the current value of the topic that triggered the call.