ProvenanceQuantumGraphReader¶
- class lsst.pipe.base.quantum_graph.ProvenanceQuantumGraphReader(header: HeaderModel, pipeline_graph: PipelineGraph, zf: zipfile.ZipFile, decompressor: Decompressor, address_reader: AddressReader, page_size: int)¶
Bases:
BaseQuantumGraphReaderA helper class for reading provenance quantum graphs.
Notes
The
opencontext manager should be used to construct new instances. Instances cannot be used after the context manager exits, except to access thegraphattribute`.The various
read_*methods in this class update thegraphattribute in place.Methods Summary
fetch_logs(nodes)Fetch log datasets.
fetch_metadata(nodes)Fetch metadata datasets.
Fetch package version information.
open(uri, *[, page_size, import_mode])Construct a reader from a URI.
read_datasets([datasets])Read information about the given datasets.
Read all bipartite edges and all quantum and dataset node attributes, fully populating the
graphattribute.Read the thin graph, with all edge information and categorization of quanta by task label.
read_quanta([quanta])Read information about the given quanta.
Methods Documentation
- fetch_logs(nodes: Iterable[UUID | int]) dict[uuid.UUID | int, list[lsst.daf.butler.logging.ButlerLogRecords | None]]¶
Fetch log datasets.
- Parameters:
- Returns:
- logs
dict[uuid.UUIDorint,list[lsst.daf.butler.ButlerLogRecordsorNone] ] Logs for the given IDs. Each value is a list of
lsst.daf.butler.ButlerLogRecordsinstances representing different execution attempts, ordered chronologically from first to last. Attempts where logs were missing will haveNonein this list.
- logs
- fetch_metadata(nodes: Iterable[UUID | int]) dict[uuid.UUID | int, list[lsst.pipe.base._task_metadata.TaskMetadata | None]]¶
Fetch metadata datasets.
- Parameters:
- Returns:
- metadata
dict[uuid.UUIDorint,list[TaskMetadata] ] Metadata for the given IDs. Each value is a list of
TaskMetadatainstances representing different execution attempts, ordered chronologically from first to last. Attempts where metadata was missing (not written even in the fallback extra provenance in the logs) will haveNonein this list.
- metadata
- classmethod open(uri: str | ParseResult | ResourcePath | Path, *, page_size: int | None = None, import_mode: TaskImportMode = TaskImportMode.DO_NOT_IMPORT) Iterator[ProvenanceQuantumGraphReader]¶
Construct a reader from a URI.
- Parameters:
- uriconvertible to
lsst.resources.ResourcePath URI to open. Should have a
.qgextension.- page_size
int, optional Approximate number of bytes to read at once from address files and multi-block files. Note that this does not set a page size for all reads, but it does affect the smallest, most numerous reads. Can also be set via the
LSST_QG_PAGE_SIZEenvironment variable.- import_mode
pipeline_graph.TaskImportMode, optional How to handle importing the task classes referenced in the pipeline graph.
- uriconvertible to
- Returns:
- reader
contextlib.AbstractContextManager[ProvenanceQuantumGraphReader] A context manager that returns the reader when entered.
- reader
- read_datasets(datasets: Iterable[UUID | int] | None = None) None¶
Read information about the given datasets.
- read_full_graph() None¶
Read all bipartite edges and all quantum and dataset node attributes, fully populating the
graphattribute.Notes
This does not read logs, metadata, or packages ; those must always be fetched explicitly.
- read_init_quanta() None¶
Read the thin graph, with all edge information and categorization of quanta by task label.