Skip to content

Commit

Permalink
Check for dataset type compatibility when creating execution butler
Browse files Browse the repository at this point in the history
  • Loading branch information
timj committed May 24, 2022
1 parent c97feba commit 8c541ef
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion python/lsst/pipe/base/executionButlerBuilder.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
from typing import Callable, DefaultDict, Iterable, List, Mapping, Optional, Set, Tuple, Union

from lsst.daf.butler import Butler, Config, DataCoordinate, DatasetRef, DatasetType
from lsst.daf.butler.registry import ConflictingDefinitionError
from lsst.daf.butler.core.repoRelocation import BUTLER_ROOT_TAG
from lsst.daf.butler.transfers import RepoExportContext
from lsst.resources import ResourcePath, ResourcePathExpression
Expand Down Expand Up @@ -218,7 +219,22 @@ def _import(

# Register datasets to be produced and insert them into the registry
for dsType, dataIds in inserts.items():
newButler.registry.registerDatasetType(dsType)
# There may be inconsistencies with storage class definitions
# so those differences must be checked.
try:
newButler.registry.registerDatasetType(dsType)
except ConflictingDefinitionError:
# We do not at this point know whether the dataset type is
# an intermediate (and so must be able to support conversion
# from the registry storage class to an input) or solely an output
# dataset type. Test both compatibilities.
registryDsType = newButler.registry.getDatasetType(dsType.name)
if registryDsType.is_compatible_with(dsType) and dsType.is_compatible_with(registryDsType):
pass
else:
# Not compatible to re-raise the original exception.
raise

newButler.registry.insertDatasets(dsType, dataIds, run)

return newButler
Expand Down

0 comments on commit 8c541ef

Please sign in to comment.