Details
-
Type:
RFC
-
Status: Implemented
-
Resolution: Done
-
Component/s: DM
-
Labels:None
-
Location:here
Description
When there are different versions of a given task, I propose that we require those tasks to have an abstract base class that defines the interface.
I further propose that the same file that defines the abstract base class also define a registry, and all implementations register themselves. This has several advantages:
- Finding variant subtasks is easier
- Switching between variant subtasks can be done from the command line (by comparison, retargeting requires a config override file)
- Switching between variant subtasks is safer because they all have the same API
- Config override files or users can configure more than one variant, again improving the ease and safety of using variants
Details of the proposal:
- Abstract base classes should use the `abc` package
- A task should have an abstract base class if it has multiple implementations or is likely to have them. Otherwise I suggest not bothering, in order to avoid clutter.
- Use `lsst.pex.config.RegistryField` for the registry. It is simple and easy to use. Note that `lsst.pipe.base.Task.makeSubtask` will need minor work to support this.
Once this is implemented I anticipate essentially all retargeting of subtasks to be replaced by use of the registry.
I'd be happy to comment on an explicit proposal for which places to use RegistryField; the ones you've listed sound reasonable.
What I'm trying to avoid is config-setter lines that look like this:
config.calibrate["DefaultCalibrate"].detectAndMeasure["DefaultDetectAndMeasure"].measurement["SingleFrameMeasurement"].slots.psfFlux = None
instead of
config.calibrate.detectAndMeasure.measurement.slots.psfFlux = None
I know you're not proposing we add registries for all of these, but I'd like to be explicit about that.
The sort of hybrid field I have in mind is one in which the RegistryField dict-like syntax is always allowed, but one can also modify the active field the same way one would modify a regular ConfigurableField.
One more thought: we should think about defining interfaces (perhaps not as ABCs) for the config classes as well. For most of these retargetable slots, I believe there are some config values that are likely common to all subclasses and others that are unique.