Skip to content

Commit

Permalink
No longer create unresolved ref in mock task
Browse files Browse the repository at this point in the history
The butler get will work with the dataset type and dataId
as separate parameters.
  • Loading branch information
timj committed Apr 19, 2023
1 parent 6d974cb commit c4a59f1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions python/lsst/ctrl/mpexec/mock_task.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,9 @@ def _get(self, ref: Optional[Union[DeferredDatasetRef, DatasetRef]]) -> Any:
mockDatasetTypeName = self.mockDatasetTypeName(datasetType.name)

try:
# Try to use the mock DatasetType if it is defined.
mockDatasetType = self.butler.registry.getDatasetType(mockDatasetTypeName)
# Is the ref needed here? Can those parameters be passed directly
# to the get() call or is this ref needed in the KeyError except
# catch?
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UnresolvedRefWarning)
ref = DatasetRef(mockDatasetType, ref.dataId)
data = self.butler.get(ref)
data = self.butler.get(mockDatasetType, ref.dataId)
except KeyError:
data = super()._get(ref)
# If the input as an actual non-mock data then we want to replace
Expand Down

0 comments on commit c4a59f1

Please sign in to comment.