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 same MetricTask class will be run by lsst.verify.gen2tasks.MetricsControllerTask multiple times with different configs.

Parameters:
namestr

The name under which this decorator will register the MetricTask.

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 with lsst.verify.gen2tasks.MetricsControllerTask.

The registry entry produced by this decorator corresponds to an anonymous Config class with one field, configs. configs is a ConfigDictField that may have any number of configs attached to it. The field will create multiple MetricTask objects, one for each config provided. See MetricsControllerTask for an example of how to use configs.

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