DatasetIdFactory

class lsst.daf.butler.DatasetIdFactory

Bases: object

Factory for dataset IDs (UUIDs).

For now the logic is hard-coded and is controlled by the user-provided value of DatasetIdGenEnum. In the future we may implement a configurable logic that can guess DatasetIdGenEnum value from other parameters.

Attributes Summary

NS_UUID

Namespace UUID used for UUID5 generation.

Methods Summary

makeDatasetId(run, datasetType, dataId, ...)

Generate dataset ID for a dataset.

resolveRef(ref, run[, idGenerationMode])

Generate resolved dataset reference for predicted datasets.

Attributes Documentation

NS_UUID = UUID('840b31d9-05cd-5161-b2c8-00d32b280d0f')

Namespace UUID used for UUID5 generation. Do not change. This was produced by uuid.uuid5(uuid.NAMESPACE_DNS, "lsst.org").

Methods Documentation

makeDatasetId(run: str, datasetType: DatasetType, dataId: DataCoordinate, idGenerationMode: DatasetIdGenEnum) UUID

Generate dataset ID for a dataset.

Parameters:
runstr

Name of the RUN collection for the dataset.

datasetTypeDatasetType

Dataset type.

dataIdDataCoordinate

Expanded data ID for the dataset.

idGenerationModeDatasetIdGenEnum

ID generation option. UNIQUE makes a random UUID4-type ID. DATAID_TYPE makes a deterministic UUID5-type ID based on a dataset type name and dataId. DATAID_TYPE_RUN makes a deterministic UUID5-type ID based on a dataset type name, run collection name, and dataId.

Returns:
datasetIduuid.UUID

Dataset identifier.

resolveRef(ref: DatasetRef, run: str, idGenerationMode: DatasetIdGenEnum = DatasetIdGenEnum.UNIQUE) DatasetRef

Generate resolved dataset reference for predicted datasets.

Parameters:
refDatasetRef

Dataset ref, can be already resolved.

runstr

Name of the RUN collection for the dataset.

idGenerationModeDatasetIdGenEnum

ID generation option. UNIQUE makes a random UUID4-type ID. DATAID_TYPE makes a deterministic UUID5-type ID based on a dataset type name and dataId. DATAID_TYPE_RUN makes a deterministic UUID5-type ID based on a dataset type name, run collection name, and dataId.

Returns:
resolvedDatasetRef

Resolved dataset ref, if input reference is already resolved it is returned without modification.

Notes

This method can only be used for predicted dataset references that do not exist yet in the database. It does not resolve existing dataset references already stored in registry.