WmsSpecificInfo#
- class lsst.ctrl.bps.WmsSpecificInfo#
Bases:
objectClass representing WMS specific information.
Each piece of information is split into two parts: a template and a context. The template is a string that can contain literal text and/or named replacement fields delimited by braces
{}. The context is a mapping between the names, corresponding to the replacement fields in the template, and their values.To produce a human-readable representation of the information, e.g., for logging purposes, it needs to be rendered first to combine these two parts. On the other hand, the context alone might be sufficient if the provided information is being ingested to a database.
Attributes Summary
The context that will be used to render the information.
The list of templates that will be used to render the information.
Methods Summary
add_message(template[, context])Add a message to the WMS information.
Attributes Documentation
- context#
The context that will be used to render the information.
Returns#
- context
dict[str,Any] A copy of the dictionary representing the mapping between every template variable and its value.
Notes#
The property returns a shallow copy of the dictionary representing the context as the intended purpose of the
WmsSpecificInfois to pass a small number of brief messages from WMS to BPS reporting subsystem. Hence, it is assumed that the dictionary will only contain immutable objects (e.g. strings, numbers).- context
- templates#
The list of templates that will be used to render the information.
Returns#
- templates
list[str] A copy of the complete list of the message templates in order in which the messages were added.
- templates
Methods Documentation
- add_message(template: str, context: dict[str, Any] | None = None, **kwargs) None#
Add a message to the WMS information.
If keyword arguments are specified, the passed context is then updated with those key/value pairs.
Parameters#
- template
str A message template.
- context
dict[str,Any], optional A mapping between template variables and their values.
- **kwargs
Additional keyword arguments.
Raises#
- ValueError
Raised if the message can’t be rendered due to errors in either the template, the context, or both.
- template