Skip to content

Commit

Permalink
Update the deprecated collection_chains with butler.collections
Browse files Browse the repository at this point in the history
  • Loading branch information
hsinfang committed Aug 30, 2024
1 parent 9b5f9f0 commit e629fa2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions python/activator/middleware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ def _transfer_data(self, datasets, calibs):
# Temporary workarounds until we have a prompt-processing default top-level collection
# in shared repos, and raw collection in dev repo, and then we can organize collections
# without worrying about DRP use cases.
self.butler.collection_chains.prepend_chain(
self.butler.collections.prepend_chain(
self.instrument.makeUmbrellaCollectionName(),
[self._collection_template,
self.instrument.makeDefaultRawIngestRunName(),
Expand Down Expand Up @@ -904,7 +904,7 @@ def _export_calib_associations(self, calib_collection, datasets):
calib_latest = self._get_local_calib_collection(calib_collection)
new = self.butler.registry.registerCollection(calib_latest, CollectionType.CALIBRATION)
if new:
self.butler.collection_chains.prepend_chain(calib_collection, [calib_latest])
self.butler.collections.prepend_chain(calib_collection, [calib_latest])

# VALIDITY-HACK: real associations are expensive to query. Just apply
# arbitrary ones and assume that the first collection in the chain is
Expand Down Expand Up @@ -1617,7 +1617,7 @@ def _chain_exports(self, output_chain: str, output_runs: collections.abc.Iterabl
self.central_butler.registry.registerCollection(output_chain, CollectionType.CHAINED)

try:
self.central_butler.collection_chains.prepend_chain(output_chain, output_runs)
self.central_butler.collections.prepend_chain(output_chain, output_runs)
except sqlalchemy.exc.IntegrityError as e:
# HACK: I don't know of a better way to distinguish exceptions
# blended by SQLAlchemy. To be removed on DM-43316.
Expand Down Expand Up @@ -1706,7 +1706,7 @@ def clean_local_repo(self, exposure_ids: set[int]) -> None:
calib_chain,
flattenChains=True,
collectionTypes=CollectionType.RUN)
self.butler.collection_chains.redefine_chain(calib_chain, [])
self.butler.collections.redefine_chain(calib_chain, [])
self.butler.pruneDatasets(calib_refs, disassociate=True, unstore=True, purge=True)
for member in calib_taggeds:
self.butler.registry.removeCollection(member)
Expand Down Expand Up @@ -1887,5 +1887,5 @@ def _remove_run_completely(butler, run):
The run to remove.
"""
for chain in butler.registry.getCollectionParentChains(run):
butler.collection_chains.remove_from_chain(chain, [run])
butler.collections.remove_from_chain(chain, [run])
butler.removeRuns([run], unstore=True)
2 changes: 1 addition & 1 deletion tests/test_middleware_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1267,7 +1267,7 @@ def test_extra_collection(self):
"""
central_butler = Butler(self.central_repo.name, writeable=True)
central_butler.registry.registerCollection("emptyrun", CollectionType.RUN)
central_butler.collection_chains.prepend_chain("refcats", ["emptyrun"])
central_butler.collections.prepend_chain("refcats", ["emptyrun"])

# Avoid collisions with other calls to prep_butler
with make_local_repo(tempfile.gettempdir(), central_butler, instname) as local_repo:
Expand Down

0 comments on commit e629fa2

Please sign in to comment.