registerMultiple¶
- lsst.verify.gen2tasks.registerMultiple(name)¶
A class decorator that registers a
lsst.verify.tasks.MetricTask
with a central repository.Unlike
register
, this decorator assumes the sameMetricTask
class will be run bylsst.verify.gen2tasks.MetricsControllerTask
multiple times with different configs.- Parameters:
- name
str
The name under which this decorator will register the
MetricTask
.
- name
- Raises:
- RuntimeError
Raised if another class has already been registered under
name
.- ValueError
Raised if this decorator is applied to a class that is not a
lsst.verify.tasks.MetricTask
.
Notes
This decorator must be used for any
MetricTask
that will have multiple instances used withlsst.verify.gen2tasks.MetricsControllerTask
.The registry entry produced by this decorator corresponds to an anonymous
Config
class with one field,configs
.configs
is aConfigDictField
that may have any number of configs attached to it. The field will create multipleMetricTask
objects, one for each config provided. SeeMetricsControllerTask
for an example of how to useconfigs
.Examples
The decorator is applied at the class definition:
>>> from lsst.verify.gen2tasks import registerMultiple >>> from lsst.verify.tasks import MetricTask >>> @registerMultiple("reusable") ... class ReusableMetricTask(MetricTask): ... pass