LimitedButler¶
- class lsst.daf.butler.LimitedButler¶
- Bases: - ABC- A minimal butler interface that is sufficient to back - PipelineTaskexecution.- Attributes Summary - This is a Generation 3 Butler. - Structure managing all dimensions recognized by this data repository ( - DimensionUniverse).- Methods Summary - datasetExistsDirect(ref)- Return - Trueif a dataset is actually present in the Datastore.- get(ref, /, *[, parameters, storageClass])- Retrieve a stored dataset. - getDeferred(ref, /, *[, parameters, ...])- Create a - DeferredDatasetHandlewhich can later retrieve a dataset, after an immediate registry lookup.- getDirect(ref, *[, parameters, storageClass])- Retrieve a stored dataset. - getDirectDeferred(ref, *[, parameters, ...])- Create a - DeferredDatasetHandlewhich can later retrieve a dataset, from a resolved- DatasetRef.- markInputUnused(ref)- Indicate that a predicted input was not actually used when processing a - Quantum.- pruneDatasets(refs, *[, disassociate, ...])- Remove one or more datasets from a collection and/or storage. - put(obj, ref, /)- Store a dataset that already has a UUID and - RUNcollection.- putDirect(obj, ref, /)- Store a dataset that already has a UUID and - RUNcollection.- stored(ref)- Indicate whether the dataset's artifacts are present in the Datastore. - stored_many(refs)- Check the datastore for artifact existence of multiple datasets at once. - Attributes Documentation - GENERATION: ClassVar[int] = 3¶
- This is a Generation 3 Butler. - This attribute may be removed in the future, once the Generation 2 Butler interface has been fully retired; it should only be used in transitional code. 
 - dimensions¶
- Structure managing all dimensions recognized by this data repository ( - DimensionUniverse).
 - Methods Documentation - datasetExistsDirect(ref: DatasetRef) bool¶
- Return - Trueif a dataset is actually present in the Datastore.- Parameters:
- refDatasetRef
- Resolved reference to a dataset. 
 
- ref
- Returns:
- existsbool
- Whether the dataset exists in the Datastore. 
 - Deprecated since version v26.0: Butler.datasetExistsDirect() has been replaced by Butler.stored(). Will be removed after v27.0. 
- exists
 
 - get(ref: DatasetRef, /, *, parameters: dict[str, Any] | None = None, storageClass: StorageClass | str | None = None) Any¶
- Retrieve a stored dataset. - Parameters:
- ref: `DatasetRef`
- A resolved - DatasetRefdirectly associated with a dataset.
- parametersdict
- Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset. 
- storageClassStorageClassorstr, optional
- The storage class to be used to override the Python type returned by this method. By default the returned type matches the dataset type definition for this dataset. Specifying a read - StorageClasscan force a different type to be returned. This type must be compatible with the original type.
 
- Returns:
- objobject
- The dataset. 
 
- obj
- Raises:
- AmbiguousDatasetError
- Raised if the supplied - DatasetRefis unresolved.
 
 - Notes - In a - LimitedButlerthe only allowable way to specify a dataset is to use a resolved- DatasetRef. Subclasses can support more options.
 - getDeferred(ref: DatasetRef, /, *, parameters: dict[str, Any] | None = None, storageClass: StorageClass | str | None = None) DeferredDatasetHandle¶
- Create a - DeferredDatasetHandlewhich can later retrieve a dataset, after an immediate registry lookup.- Parameters:
- refDatasetRef
- For the default implementation of a - LimitedButler, the only acceptable parameter is a resolved- DatasetRef.
- parametersdict
- Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset. 
- storageClassStorageClassorstr, optional
- The storage class to be used to override the Python type returned by this method. By default the returned type matches the dataset type definition for this dataset. Specifying a read - StorageClasscan force a different type to be returned. This type must be compatible with the original type.
 
- ref
- Returns:
- objDeferredDatasetHandle
- A handle which can be used to retrieve a dataset at a later time. 
 
- obj
 - Notes - In a - LimitedButlerthe only allowable way to specify a dataset is to use a resolved- DatasetRef. Subclasses can support more options.
 - getDirect(ref: DatasetRef, *, parameters: dict[str, Any] | None = None, storageClass: StorageClass | str | None = None) Any¶
- Retrieve a stored dataset. - Parameters:
- refDatasetRef
- Resolved reference to an already stored dataset. 
- parametersdict
- Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset. 
- storageClassStorageClassorstr, optional
- The storage class to be used to override the Python type returned by this method. By default the returned type matches the dataset type definition for this dataset. Specifying a read - StorageClasscan force a different type to be returned. This type must be compatible with the original type.
 
- ref
- Returns:
- objobject
- The dataset. 
 - Deprecated since version v26.0: Butler.get() now behaves like Butler.getDirect() when given a DatasetRef. Please use Butler.get(). Will be removed after v27.0. 
- obj
 
 - getDirectDeferred(ref: DatasetRef, *, parameters: dict[str, Any] | None = None, storageClass: StorageClass | str | None = None) DeferredDatasetHandle¶
- Create a - DeferredDatasetHandlewhich can later retrieve a dataset, from a resolved- DatasetRef.- Parameters:
- refDatasetRef
- Resolved reference to an already stored dataset. 
- parametersdict
- Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset. 
- storageClassStorageClassorstr, optional
- The storage class to be used to override the Python type returned by this method. By default the returned type matches the dataset type definition for this dataset. Specifying a read - StorageClasscan force a different type to be returned. This type must be compatible with the original type.
 
- ref
- Returns:
- objDeferredDatasetHandle
- A handle which can be used to retrieve a dataset at a later time. 
 - Deprecated since version v26.0: Butler.getDeferred() now behaves like getDirectDeferred() when given a DatasetRef. Please use Butler.getDeferred(). Will be removed after v27.0. 
- obj
 
 - markInputUnused(ref: DatasetRef) None¶
- Indicate that a predicted input was not actually used when processing a - Quantum.- Parameters:
- refDatasetRef
- Reference to the unused dataset. 
 
- ref
 - Notes - By default, a dataset is considered “actually used” if it is accessed via - getDirector a handle to it is obtained via- getDirectDeferred(even if the handle is not used). This method must be called after one of those in order to remove the dataset from the actual input list.- This method does nothing for butlers that do not store provenance information (which is the default implementation provided by the base class). 
 - abstract pruneDatasets(refs: Iterable[DatasetRef], *, disassociate: bool = True, unstore: bool = False, tags: Iterable[str] = (), purge: bool = False) None¶
- Remove one or more datasets from a collection and/or storage. - Parameters:
- refsIterableofDatasetRef
- Datasets to prune. These must be “resolved” references (not just a - DatasetTypeand data ID).
- disassociatebool, optional
- Disassociate pruned datasets from - tags, or from all collections if- purge=True.
- unstorebool, optional
- If - True(- Falseis default) remove these datasets from all datastores known to this butler. Note that this will make it impossible to retrieve these datasets even via other collections. Datasets that are already not stored are ignored by this option.
- tagsIterable[str], optional
- TAGGEDcollections to disassociate the datasets from. Ignored if- disassociateis- Falseor- purgeis- True.
- purgebool, optional
- If - True(- Falseis default), completely remove the dataset from the- Registry. To prevent accidental deletions,- purgemay only be- Trueif all of the following conditions are met:- This mode may remove provenance information from datasets other than those provided, and should be used with extreme care. 
 
- refs
- Raises:
- TypeError
- Raised if the butler is read-only, if no collection was provided, or the conditions for - purge=Truewere not met.
 
 
 - abstract put(obj: Any, ref: DatasetRef, /) DatasetRef¶
- Store a dataset that already has a UUID and - RUNcollection.- Parameters:
- objobject
- The dataset. 
- refDatasetRef
- Resolved reference for a not-yet-stored dataset. 
 
- obj
- Returns:
- refDatasetRef
- The same as the given, for convenience and symmetry with - Butler.put.
 
- ref
- Raises:
- TypeError
- Raised if the butler is read-only. 
 
 - Notes - Whether this method inserts the given dataset into a - Registryis implementation defined (some- LimitedButlersubclasses do not have a- Registry), but it always adds the dataset to a- Datastore, and the given- ref.idand- ref.runare always preserved.
 - putDirect(obj: Any, ref: DatasetRef, /) DatasetRef¶
- Store a dataset that already has a UUID and - RUNcollection.- Parameters:
- objobject
- The dataset. 
- refDatasetRef
- Resolved reference for a not-yet-stored dataset. 
 
- obj
- Returns:
- refDatasetRef
- The same as the given, for convenience and symmetry with - Butler.put.
 
- ref
- Raises:
- TypeError
- Raised if the butler is read-only. 
 
 - Notes - Whether this method inserts the given dataset into a - Registryis implementation defined (some- LimitedButlersubclasses do not have a- Registry), but it always adds the dataset to a- Datastore, and the given- ref.idand- ref.runare always preserved.- Deprecated since version v26.0: Butler.put() now behaves like Butler.putDirect() when given a DatasetRef. Please use Butler.put(). Will be removed after v27.0. 
 - stored(ref: DatasetRef) bool¶
- Indicate whether the dataset’s artifacts are present in the Datastore. - Parameters:
- refDatasetRef
- Resolved reference to a dataset. 
 
- ref
- Returns:
- storedbool
- Whether the dataset artifact exists in the datastore and can be retrieved. 
 
- stored
 
 - stored_many(refs: Iterable[DatasetRef]) dict[lsst.daf.butler.core.datasets.ref.DatasetRef, bool]¶
- Check the datastore for artifact existence of multiple datasets at once. - Parameters:
- refsiterable of DatasetRef
- The datasets to be checked. 
 
- refsiterable of 
- Returns:
- existencedictof [DatasetRef,bool]
- Mapping from given dataset refs to boolean indicating artifact existence. 
 
- existence