Skip to content

Commit

Permalink
Ensure that dimension records are inserted in the right order
Browse files Browse the repository at this point in the history
This makes sure that exposure is inserted before visit and
before visit_definition.
  • Loading branch information
timj committed Dec 6, 2023
1 parent eac62e2 commit bbb15f3
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions python/lsst/daf/butler/direct_butler.py
Original file line number Diff line number Diff line change
Expand Up @@ -1890,8 +1890,9 @@ def transfer_dimension_records_from(
source_butler, data_ids, elements
)

for element, r in dimension_records.items():
records = [r[dataId] for dataId in r]
# Insert order is important.
for element in self.dimensions.sorted(dimension_records.keys()):
records = [r for r in dimension_records[element].values()]
# Assume that if the record is already present that we can
# use it without having to check that the record metadata
# is consistent.
Expand Down Expand Up @@ -2097,8 +2098,9 @@ def transfer_from(
with self.transaction():
if dimension_records:
_LOG.verbose("Ensuring that dimension records exist for transferred datasets.")
for element, r in dimension_records.items():
records = [r[dataId] for dataId in r]
# Order matters.
for element in self.dimensions.sorted(dimension_records.keys()):
records = [r for r in dimension_records[element].values()]
# Assume that if the record is already present that we can
# use it without having to check that the record metadata
# is consistent.
Expand Down

0 comments on commit bbb15f3

Please sign in to comment.