Clock#
- class lsst.ts.watcher.rules.Clock(config, log=None)#
Bases:
BaseRuleMonitor the system clock of a SAL component using the
heartbeatevent.Set alarm severity WARNING if the absolute value of the clock error is above the configured threshold for
min_errorssequential heartbeat events. The clock error is computed as the difference between the time the heartbeat event was sent and received; thus some delay is inevitable.- Parameters:
config (
types.SimpleNamespace) – Rule configuration, as validated by the schema.log (
logging.Logger, optional) – Parent logger.
Notes
The alarm name is f”Clock.{name}:{index}”, where name and index are derived from
config.name.Attributes Summary
Number of sequential errors required for a failure
Methods Summary
compute_alarm_severity(data[, topic_callback])Compute and set alarm severity and reason.
Return a jsonschema as a
dict, to validate configuration.Attributes Documentation
- min_errors = 3#
Number of sequential errors required for a failure
Methods Documentation
- compute_alarm_severity(data, topic_callback=None)#
Compute and set alarm severity and reason.
- Parameters:
**kwargs (
dict[str,typing.Any]) –Keyword arguments. If triggered by
TopicCallbackcallingupdate_alarm_severity, the arguments will be as follows:data :
salobj.BaseMsgTypeMessage from the topic described by topic_callback.topic_callback :
TopicCallbackTopic callback wrapper.
- Return type:
- Returns:
None, if no change or unknown, or a tuple of two values
severity (
lsst.ts.xml.enums.Watcher.AlarmSeverity) – The new alarm severity.reason (
str) – Detailed reason for the severity, e.g. a string describing what value is out of range, and what the range is. IfseverityisNONEthen this value is ignored (but still required) and the old reason is retained until the alarm is reset tonominalstate.
Notes
You may return
NoneNoReasonif the alarm state isNONE.- Parameters:
data (
BaseMsgType)topic_callback (
TopicCallback|None, default:None)
- classmethod get_schema()#
Return a jsonschema as a
dict, to validate configuration.Notes
Please provide default values for all fields for which defaults make sense. This makes watcher configuration files easier to write.
If your rule has no configuration then return
None.We recommend that you write the schema as yaml, for compactness, then use yaml.safe_load to convert it to a dict. For example:
schema_yaml = """ $schema: http://json-schema.org/draft-07/schema# description: Configuration for MyRule type: object properties: ... required: [...] additionalProperties: false """ return yaml.safe_load(schema_yaml)