Skip to content

Commit

Permalink
Minor review-inspired cleanups for PipelineGraph.
Browse files Browse the repository at this point in the history
  • Loading branch information
TallJimbo committed Aug 4, 2023
1 parent 8f0d3fa commit 14334a4
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions python/lsst/pipe/base/pipeline_graph/_pipeline_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -503,6 +503,9 @@ def resolve(self, registry: Registry) -> None:
new_dataset_type_node = DatasetTypeNode._from_edges(
node_key, self._xgraph, registry, previous=dataset_type_node
)
# Usage of `is`` here is intentional; `_from_edges` returns
# `previous=dataset_type_node` if it can determine that it
# doesn't need to change.
if new_dataset_type_node is not dataset_type_node:
updates[node_key] = new_dataset_type_node
try:
Expand Down Expand Up @@ -582,12 +585,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])
Expand Down Expand Up @@ -1449,7 +1450,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 = {}
Expand Down

0 comments on commit 14334a4

Please sign in to comment.