ButlerCollections

class lsst.daf.butler.ButlerCollections

Bases: ABC

Methods for working with collections stored in the Butler.

Methods Summary

extend_chain(parent_collection_name, ...)

Add children to the end of a CHAINED collection.

prepend_chain(parent_collection_name, ...)

Add children to the beginning of a CHAINED collection.

redefine_chain(parent_collection_name, ...)

Replace the contents of a CHAINED collection with new children.

remove_from_chain(parent_collection_name, ...)

Remove children from a CHAINED collection.

Methods Documentation

abstract extend_chain(parent_collection_name: str, child_collection_names: str | Iterable[str]) None

Add children to the end of a CHAINED collection.

If any of the children already existed in the chain, they will be moved to the new position at the end of the chain.

Parameters:
parent_collection_namestr

The name of a CHAINED collection to which we will add new children.

child_collection_namesIterable [ str ` ] | `str

A child collection name or list of child collection names to be added to the parent.

Raises:
MissingCollectionError

If any of the specified collections do not exist.

CollectionTypeError

If the parent collection is not a CHAINED collection.

CollectionCycleError

If this operation would create a collection cycle.

Notes

If this function is called within a call to Butler.transaction, it will hold a lock that prevents other processes from modifying the parent collection until the end of the transaction. Keep these transactions short.

abstract prepend_chain(parent_collection_name: str, child_collection_names: str | Iterable[str]) None

Add children to the beginning of a CHAINED collection.

If any of the children already existed in the chain, they will be moved to the new position at the beginning of the chain.

Parameters:
parent_collection_namestr

The name of a CHAINED collection to which we will add new children.

child_collection_namesIterable [ str ` ] | `str

A child collection name or list of child collection names to be added to the parent.

Raises:
MissingCollectionError

If any of the specified collections do not exist.

CollectionTypeError

If the parent collection is not a CHAINED collection.

CollectionCycleError

If this operation would create a collection cycle.

Notes

If this function is called within a call to Butler.transaction, it will hold a lock that prevents other processes from modifying the parent collection until the end of the transaction. Keep these transactions short.

abstract redefine_chain(parent_collection_name: str, child_collection_names: str | Iterable[str]) None

Replace the contents of a CHAINED collection with new children.

Parameters:
parent_collection_namestr

The name of a CHAINED collection to which we will assign new children.

child_collection_namesIterable [ str ` ] | `str

A child collection name or list of child collection names to be added to the parent.

Raises:
MissingCollectionError

If any of the specified collections do not exist.

CollectionTypeError

If the parent collection is not a CHAINED collection.

CollectionCycleError

If this operation would create a collection cycle.

Notes

If this function is called within a call to Butler.transaction, it will hold a lock that prevents other processes from modifying the parent collection until the end of the transaction. Keep these transactions short.

abstract remove_from_chain(parent_collection_name: str, child_collection_names: str | Iterable[str]) None

Remove children from a CHAINED collection.

Parameters:
parent_collection_namestr

The name of a CHAINED collection from which we will remove children.

child_collection_namesIterable [ str ` ] | `str

A child collection name or list of child collection names to be removed from the parent.

Raises:
MissingCollectionError

If any of the specified collections do not exist.

CollectionTypeError

If the parent collection is not a CHAINED collection.

Notes

If this function is called within a call to Butler.transaction, it will hold a lock that prevents other processes from modifying the parent collection until the end of the transaction. Keep these transactions short.