From d909c49bcb0a679ee16c5a8e8873262bec1da024 Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Thu, 1 Aug 2024 14:07:25 -0400 Subject: [PATCH 1/2] Make DeferredDatasetRef a better proxy for DatasetRef. I'd prefer we not use this approach to signalling deferred loads to QuantumContext at all, but removing it is way out of scope. --- python/lsst/pipe/base/connections.py | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/python/lsst/pipe/base/connections.py b/python/lsst/pipe/base/connections.py index 0ddf9e717..86b0b6dac 100644 --- a/python/lsst/pipe/base/connections.py +++ b/python/lsst/pipe/base/connections.py @@ -493,15 +493,8 @@ class DeferredDatasetRef: datasetRef: DatasetRef - @property - def datasetType(self) -> DatasetType: - """The dataset type for this dataset.""" - return self.datasetRef.datasetType - - @property - def dataId(self) -> DataCoordinate: - """The data ID for this dataset.""" - return self.datasetRef.dataId + def __getattr__(self, name: str) -> Any: + return getattr(self.datasetRef, name) class PipelineTaskConnections(metaclass=PipelineTaskConnectionsMetaclass): From 36fc00eabc156097b19743ef52cc12ce0d97a4cb Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Thu, 1 Aug 2024 14:09:42 -0400 Subject: [PATCH 2/2] Check for Task metadata inputs in mocking system. --- doc/changes/DM-45536.bugfix.md | 1 + python/lsst/pipe/base/tests/mocks/_pipeline_task.py | 5 +++++ 2 files changed, 6 insertions(+) create mode 100644 doc/changes/DM-45536.bugfix.md diff --git a/doc/changes/DM-45536.bugfix.md b/doc/changes/DM-45536.bugfix.md new file mode 100644 index 000000000..6624dcd80 --- /dev/null +++ b/doc/changes/DM-45536.bugfix.md @@ -0,0 +1 @@ +Fix support for task metadata as inputs in the `PipelineTask` mocking system. diff --git a/python/lsst/pipe/base/tests/mocks/_pipeline_task.py b/python/lsst/pipe/base/tests/mocks/_pipeline_task.py index e191e3b1c..c8bdda9b2 100644 --- a/python/lsst/pipe/base/tests/mocks/_pipeline_task.py +++ b/python/lsst/pipe/base/tests/mocks/_pipeline_task.py @@ -425,6 +425,11 @@ def __init__(self, *, config: MockPipelineTaskConfig): raise ValueError( f"Unmocked dataset type {connection.name!r} cannot be used as an init-output." ) + elif connection.name.endswith("_metadata") and connection.storageClass == "TaskMetadata": + # Task metadata does not use a mock storage class, because it's + # written by the system, but it does end up with the _mock_* + # prefix because the task label does. + connection = dataclasses.replace(connection, name=get_mock_name(connection.name)) setattr(self, name, connection) def getSpatialBoundsConnections(self) -> Iterable[str]: