From b875dd91a69384b1a43000d00cc49053b128ddbd Mon Sep 17 00:00:00 2001 From: Jim Bosch Date: Thu, 3 Aug 2023 12:46:56 -0400 Subject: [PATCH] Minor review-inspired cleanups for PipelineGraph. --- .../pipe/base/pipeline_graph/_pipeline_graph.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/python/lsst/pipe/base/pipeline_graph/_pipeline_graph.py b/python/lsst/pipe/base/pipeline_graph/_pipeline_graph.py index 86f8d3dc3..8e8936d8f 100644 --- a/python/lsst/pipe/base/pipeline_graph/_pipeline_graph.py +++ b/python/lsst/pipe/base/pipeline_graph/_pipeline_graph.py @@ -463,7 +463,7 @@ def resolve(self, registry: Registry) -> None: Notes ----- - The `universe` attribute are set to ``registry.dimensions`` and used to + The `universe` attribute is set to ``registry.dimensions`` and used to set all `TaskNode.dimensions` attributes. Dataset type nodes are resolved by first looking for a registry definition, then using the producing task's definition, then looking for consistency between all @@ -582,12 +582,10 @@ def add_task( it references and marks the graph as unsorted. It is most effiecient to add all tasks up front and only then resolve and/or sort the graph. """ - key = NodeKey(NodeType.TASK, label) - init_key = NodeKey(NodeType.TASK_INIT, label) task_node = TaskNode._from_imported_data( - key, - init_key, - _TaskNodeImportedData.configure(label, task_class, config, connections), + key=NodeKey(NodeType.TASK, label), + init_key=NodeKey(NodeType.TASK_INIT, label), + data=_TaskNodeImportedData.configure(label, task_class, config, connections), universe=self.universe, ) self.add_task_nodes([task_node]) @@ -1449,7 +1447,10 @@ def _init_from_args( self._dataset_types = DatasetTypeMappingView(self._xgraph) self._raw_data_id: dict[str, Any] if isinstance(data_id, DataCoordinate): - universe = data_id.universe + if universe is None: + universe = data_id.universe + else: + assert universe is data_id.universe, "data_id.universe and given universe differ" self._raw_data_id = data_id.byName() elif data_id is None: self._raw_data_id = {}