Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-16822: Use pipe.base.*DatasetConfig in MetricTask configs #32

Merged
merged 3 commits into from
Jan 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion COPYRIGHT
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
Copyright (c) 2016-2017 Association of Universities for Research in Astronomy, Inc.
Copyright (c) 2016-2017 University of Washington
Copyright (c) 2016-2019 University of Washington
Copyright (c) 2015-2016 University of Pittsburgh
25 changes: 19 additions & 6 deletions python/lsst/verify/compatibility/metricTask.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ class MetricTask(pipeBase.Task, metaclass=abc.ABCMeta):

Parameters
----------
args
kwargs
*args
**kwargs
Constructor parameters are the same as for
`lsst.pipe.base.PipelineTask`.

Expand All @@ -45,8 +45,10 @@ class MetricTask(pipeBase.Task, metaclass=abc.ABCMeta):
granularity, including repository-wide.

Like `lsst.pipe.base.PipelineTask`, this class should be customized by
overriding one of `run` or `adaptArgsAndRun`. For requirements on these
methods that are specific to ``MetricTask``, see `adaptArgsAndRun`.
overriding one of `run` or `adaptArgsAndRun` and by providing an
`~lsst.pipe.base.InputDatasetField` for each parameter of `run`. For
requirements on these methods that are specific to ``MetricTask``, see
`adaptArgsAndRun`.

.. note::
The API is designed to make it easy to convert all ``MetricTasks`` to
Expand All @@ -55,7 +57,8 @@ class MetricTask(pipeBase.Task, metaclass=abc.ABCMeta):
quanta, or `lsst.daf.butler`.
"""

# There may be a specialized MetricTaskConfig later, details TBD
# TODO: create a specialized MetricTaskConfig once metrics have
# Butler datasets
ConfigClass = lsst.pex.config.Config

def adaptArgsAndRun(self, inputData, inputDataIds, outputDataId):
Expand Down Expand Up @@ -146,7 +149,6 @@ def adaptArgsAndRun(self, inputData, inputDataIds, outputDataId):
return result

@classmethod
@abc.abstractmethod
def getInputDatasetTypes(cls, config):
"""Return input dataset types for this task.

Expand All @@ -161,7 +163,18 @@ def getInputDatasetTypes(cls, config):
Dictionary where the key is the name of the input dataset (must
match a parameter to `run`) and the value is the name of its
Butler dataset type.

Notes
-----
The default implementation searches ``config`` for
`~lsst.pipe.base.InputDatasetConfig` fields, much like
`lsst.pipe.base.PipelineTask.getInputDatasetTypes` does.
"""
datasets = {}
for key, value in config.items():
if isinstance(value, lsst.pipe.base.InputDatasetConfig):
datasets[key] = value.name
return datasets

@classmethod
@abc.abstractmethod
Expand Down
2 changes: 1 addition & 1 deletion python/lsst/verify/metricTask.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of project_name.
# This file is part of verify.
#
# Developed for the LSST Data Management System.
# This product includes software developed by the LSST Project
Expand Down