LimitedButler¶
-
class
lsst.daf.butler.
LimitedButler
¶ Bases:
abc.ABC
A minimal butler interface that is sufficient to back
PipelineTask
execution.Attributes Summary
GENERATION
This is a Generation 3 Butler. dimensions
Structure managing all dimensions recognized by this data repository ( DimensionUniverse
).Methods Summary
datasetExistsDirect
(ref)Return True
if a dataset is actually present in the Datastore.getDirect
(ref, *, parameters, Any], …)Retrieve a stored dataset. getDirectDeferred
(ref, *, parameters, …)Create a DeferredDatasetHandle
which can later retrieve a dataset, from a resolvedDatasetRef
.isWriteable
()Return True
if thisButler
supports write operations.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. putDirect
(obj, ref)Store a dataset that already has a UUID and RUN
collection.Attributes Documentation
-
GENERATION
= 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: lsst.daf.butler.core.datasets.ref.DatasetRef) → bool¶ Return
True
if a dataset is actually present in the Datastore.Parameters: - ref :
DatasetRef
Resolved reference to a dataset.
Returns: - exists :
bool
Whether the dataset exists in the Datastore.
- ref :
-
getDirect
(ref: lsst.daf.butler.core.datasets.ref.DatasetRef, *, parameters: Optional[Dict[str, Any], None] = None, storageClass: Union[lsst.daf.butler.core.storageClass.StorageClass, str, None] = None) → Any¶ Retrieve a stored dataset.
Unlike
Butler.get
, this method allows datasets outside the Butler’s collection to be read as long as theDatasetRef
that identifies them can be obtained separately.Parameters: - ref :
DatasetRef
Resolved reference to an already stored dataset.
- parameters :
dict
Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset.
- storageClass :
StorageClass
orstr
, 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
StorageClass
can force a different type to be returned. This type must be compatible with the original type.
Returns: - obj :
object
The dataset.
Raises: - AmbiguousDatasetError
Raised if
ref.id is None
, i.e. the reference is unresolved.
- ref :
-
getDirectDeferred
(ref: lsst.daf.butler.core.datasets.ref.DatasetRef, *, parameters: Optional[dict, None] = None, storageClass: Union[lsst.daf.butler.core.storageClass.StorageClass, str, None] = None) → lsst.daf.butler._deferredDatasetHandle.DeferredDatasetHandle¶ Create a
DeferredDatasetHandle
which can later retrieve a dataset, from a resolvedDatasetRef
.Parameters: - ref :
DatasetRef
Resolved reference to an already stored dataset.
- parameters :
dict
Additional StorageClass-defined options to control reading, typically used to efficiently read only a subset of the dataset.
- storageClass :
StorageClass
orstr
, 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
StorageClass
can force a different type to be returned. This type must be compatible with the original type.
Returns: - obj :
DeferredDatasetHandle
A handle which can be used to retrieve a dataset at a later time.
Raises: - AmbiguousDatasetError
Raised if
ref.id is None
, i.e. the reference is unresolved.
- ref :
-
markInputUnused
(ref: lsst.daf.butler.core.datasets.ref.DatasetRef) → None¶ Indicate that a predicted input was not actually used when processing a
Quantum
.Parameters: - ref :
DatasetRef
Reference to the unused dataset.
Notes
By default, a dataset is considered “actually used” if it is accessed via
getDirect
or a handle to it is obtained viagetDirectDeferred
(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).
- ref :
-
pruneDatasets
(refs: Iterable[lsst.daf.butler.core.datasets.ref.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: - refs :
Iterable
ofDatasetRef
Datasets to prune. These must be “resolved” references (not just a
DatasetType
and data ID).- disassociate :
bool
, optional Disassociate pruned datasets from
tags
, or from all collections ifpurge=True
.- unstore :
bool
, optional If
True
(False
is 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.- tags :
Iterable
[str
], optional TAGGED
collections to disassociate the datasets from. Ignored ifdisassociate
isFalse
orpurge
isTrue
.- purge :
bool
, optional If
True
(False
is default), completely remove the dataset from theRegistry
. To prevent accidental deletions,purge
may only beTrue
if 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.
Raises: - TypeError
Raised if the butler is read-only, if no collection was provided, or the conditions for
purge=True
were not met.
- refs :
-
putDirect
(obj: Any, ref: lsst.daf.butler.core.datasets.ref.DatasetRef) → lsst.daf.butler.core.datasets.ref.DatasetRef¶ Store a dataset that already has a UUID and
RUN
collection.Parameters: - obj :
object
The dataset.
- ref :
DatasetRef
Resolved reference for a not-yet-stored dataset.
Returns: - ref :
DatasetRef
The same as the given, for convenience and symmetry with
Butler.put
.
Raises: - TypeError
Raised if the butler is read-only.
- AmbiguousDatasetError
Raised if
ref.id is None
, i.e. the reference is unresolved.
Notes
Whether this method inserts the given dataset into a
Registry
is implementation defined (someLimitedButler
subclasses do not have aRegistry
), but it always adds the dataset to aDatastore
, and the givenref.id
andref.run
are always preserved.- obj :
-