Skip to content

Commit

Permalink
Switch IdGenerator example to PipelineTask/runQuantum.
Browse files Browse the repository at this point in the history
This better reflects most real-world usage.
  • Loading branch information
TallJimbo committed Apr 26, 2023
1 parent 711e998 commit bf7d0f9
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions python/lsst/meas/base/_id_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,21 +230,25 @@ class IdGenerator:
from lsst.meas.base import DetectorVisitIdGeneratorConfig
from lsst.pex.config import Config
from lsst.pipe.base import Task
from lsst.pipe.base import PipelineTask
class SomeTaskConfig(Config):
class SomeTaskConfig(PipelineTaskConfig, ...):
id_generator = DetectorVisitIdGeneratorConfig.make_field()
class SomeTask(Task):
class SomeTask(PipelineTaskTask):
ConfigClass = SomeTaskConfig
...
def run(self, ..., data_id: DataCoordinate):
def runQuantum(self, ..., data_id: DataCoordinate):
id_generator = self.config.apply(data_id)
catalog = id_generator.make_source_catalog(self.schema) ...
There is no requirement that `IdGenerator` instances be constructed in
`PipelineTask.runQuantum` methods and passed to the ``run`` method, but
this is the most common approach.
Code that wishes to instead unpack these record IDs to obtain the release
ID, data ID and counter value should use the same config (often loaded from
the ``Butler``) and pass a fully-expanded data ID identifying only a
Expand Down

0 comments on commit bf7d0f9

Please sign in to comment.