# Variant tasks should have a registry and an abstract base class

XMLWordPrintable

## Details

• Type: RFC
• Status: Implemented
• Resolution: Done
• Component/s:
• 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.

## People

• Assignee:
Russell Owen
Reporter:
Russell Owen
Watchers:
Jim Bosch, John Swinbank, Kian-Tat Lim, Paul Price, Robert Lupton, Russell Owen, Tim Jenness