Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-41365: Use new Butler get_dataset_type and find_dataset APIs #382

Merged
merged 1 commit into from
Nov 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion python/lsst/pipe/base/prerequisite_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
# and when that happens PrerequisiteFinder.find never gets
# called.
try:
ref = butler.registry.findDataset(
ref = butler.find_dataset(

Check warning on line 287 in python/lsst/pipe/base/prerequisite_helpers.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/prerequisite_helpers.py#L287

Added line #L287 was not covered by tests
self.dataset_type_node.dataset_type,
data_id.subset(self.constraint_dimensions),
collections=input_collections,
Expand Down
14 changes: 4 additions & 10 deletions python/lsst/pipe/base/quantum_graph_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,9 +223,7 @@
self.skip_existing_starts_with_output_run = False
self.existing_datasets = ExistingDatasets()
try:
packages_storage_class = butler.registry.getDatasetType(
acc.PACKAGES_INIT_OUTPUT_NAME
).storageClass_name
packages_storage_class = butler.get_dataset_type(acc.PACKAGES_INIT_OUTPUT_NAME).storageClass_name
except MissingDatasetTypeError:
packages_storage_class = acc.PACKAGES_INIT_OUTPUT_STORAGE_CLASS
self._global_init_output_types = {
Expand Down Expand Up @@ -941,9 +939,7 @@
# Dataset type is an overall input; we always need to try to
# find these.
try:
ref = self.butler.registry.findDataset(
dataset_type.name, collections=self.input_collections
)
ref = self.butler.find_dataset(dataset_type.name, collections=self.input_collections)

Check warning on line 942 in python/lsst/pipe/base/quantum_graph_builder.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/quantum_graph_builder.py#L942

Added line #L942 was not covered by tests
except MissingDatasetTypeError:
ref = None
if ref is not None:
Expand All @@ -953,9 +949,7 @@
# if only they're from previously executed quanta that we might
# skip...
try:
ref = self.butler.registry.findDataset(
dataset_type.name, collections=self.skip_existing_in
)
ref = self.butler.find_dataset(dataset_type.name, collections=self.skip_existing_in)

Check warning on line 952 in python/lsst/pipe/base/quantum_graph_builder.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/quantum_graph_builder.py#L952

Added line #L952 was not covered by tests
except MissingDatasetTypeError:
ref = None
if ref is not None:
Expand All @@ -966,7 +960,7 @@
# ...or if they're in the way and would need to be clobbered
# (and we haven't already found them in the previous block).
try:
ref = self.butler.registry.findDataset(dataset_type.name, collections=[self.output_run])
ref = self.butler.find_dataset(dataset_type.name, collections=[self.output_run])
except MissingDatasetTypeError:
ref = None
if ref is not None:
Expand Down
6 changes: 3 additions & 3 deletions python/lsst/pipe/base/testUtils.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,16 +264,16 @@ def _refFromConnection(
_checkDimensionsMatch(universe, set(connection.dimensions), dataId.keys())
dataId = DataCoordinate.standardize(dataId, **kwargs, universe=universe)

datasetType = butler.registry.getDatasetType(connection.name)
datasetType = butler.get_dataset_type(connection.name)

try:
butler.registry.getDatasetType(datasetType.name)
butler.get_dataset_type(datasetType.name)
except KeyError:
raise ValueError(f"Invalid dataset type {connection.name}.") from None
if not butler.run:
raise ValueError("Can not create a resolved DatasetRef since the butler has no default run defined.")
try:
registry_ref = butler.registry.findDataset(datasetType, dataId, collections=[butler.run])
registry_ref = butler.find_dataset(datasetType, dataId, collections=[butler.run])
if registry_ref:
ref = registry_ref
else:
Expand Down