lsst.pipe.base

The lsst.pipe.base module provides base classes for the task framework. Tasks package the algorithmic units of the LSST Science Pipelines. You can create, configure, and run tasks with their Python APIs. Some tasks, called pipeline tasks, can be packaged into data processing pipelines that you can run from the command line.

Changes

Using lsst.pipe.base

Overview

Developing tasks and pipeline tasks

Developing Pipelines

Contributing

lsst.pipe.base is developed at https://github.com/lsst/pipe_base. You can find Jira issues for this module under the pipe_base component.

Python API reference

lsst.pipe.base Package

Functions

buildExecutionButler(butler, graph, ...[, ...])

Create an execution butler.

iterConnections(connections, connectionType)

Create an iterator over the selected connections type which yields all the defined connections of that type.

Classes

AdjustQuantumHelper(inputs, outputs[, ...])

Helper class for calling PipelineTaskConnections.adjustQuantum.

AlgorithmError

Exception that may be raised by PipelineTasks (and code they delegate to) in order to indicate a repeatable algorithmic failure that will not be addressed by retries.

AnnotatedPartialOutputsError

Exception that runQuantum raises when the (partial) outputs it has written contain information about their own incompleteness or degraded quality.

DeferredDatasetRef(datasetRef)

A wrapper class for DatasetRef that indicates that a PipelineTask should receive a DeferredDatasetHandle instead of an in-memory dataset.

ExecutionResources(*[, num_cores, max_mem, ...])

A description of the resources available to a running quantum.

GetDictMetadata(*args, **kwargs)

Protocol for objects that can extract a possibly-nested mapping of primitives.

GetSetDictMetadata(*args, **kwargs)

Protocol for objects that can assign and extract a possibly-nested mapping of primitives.

InMemoryDatasetHandle(inMemoryDataset, *[, ...])

An in-memory version of a DeferredDatasetHandle.

IncompatibleGraphError

Exception class to indicate that a lookup by NodeId is impossible due to incompatibilities.

InputQuantizedConnection(**kwargs)

Input variant of a QuantizedConnection.

Instrument([collection_prefix])

Base class for instrument-specific logic for the Gen3 Butler.

InvalidQuantumError

Exception that may be raised by PipelineTasks (and code they delegate to) in order to indicate logic bug or configuration problem.

LabelSpecifier([labels, begin, end])

A structure to specify a subset of labels to load.

NoWorkFound

An exception raised when a Quantum should not exist because there is no work for it to do.

NodeId(number, buildId)

Deprecated, this class is used with QuantumGraph save formats of 1 and 2 when unpicking objects and must be retained until those formats are considered unloadable.

ObservationDimensionPacker(data_id[, ...])

A DimensionPacker for visit+detector or exposure+detector.

ObservationDimensionPackerConfig(*args, **kw)

Config associated with a ObservationDimensionPacker.

OutputQuantizedConnection(**kwargs)

Output variant of a QuantizedConnection.

Pipeline(description)

A Pipeline is a representation of a series of tasks to run, and the configuration for those tasks.

PipelineTask(*[, config, log, initInputs])

Base class for all pipeline tasks.

PipelineTaskConfig(*args, **kw)

Configuration class for PipelineTask.

PipelineTaskConnections(*[, config])

PipelineTaskConnections is a class used to declare desired IO when a PipelineTask is run by an activator.

QgraphSummary(*, graphID[, cmdLine, ...])

Report for the QuantumGraph creation or reading.

QgraphTaskSummary(*[, taskLabel, numQuanta, ...])

Quanta information summarized for single PipelineTask.

QuantizedConnection(**kwargs)

A Namespace to map defined variable names of connections to the associated lsst.daf.butler.DatasetRef objects.

QuantumContext(butler, quantum, *[, ...])

A Butler-like class specialized for a single quantum along with context information that can influence how the task is executed.

QuantumGraph(quanta[, metadata, universe, ...])

QuantumGraph is a directed acyclic graph of QuantumNode objects.

QuantumNode(quantum, taskDef, nodeId)

Class representing a node in the quantum graph.

QuantumSuccessCaveats(value[, names, ...])

Flags that add caveats to a "successful" quantum.

RepeatableQuantumError

Exception that may be raised by PipelineTasks (and code they delegate to) in order to indicate that a repeatable problem that will not be addressed by retries.

ScalarError

Exception raised when dataset type is configured as scalar but there are multiple data IDs in a Quantum for that dataset.

SetDictMetadata(*args, **kwargs)

Protocol for objects that can be assigned a possibly-nested dict of primitives.

Struct(**keyArgs)

A container to which you can add fields as attributes.

Task([config, name, parentTask, log])

Base class for data processing tasks.

TaskDef([taskName, config, taskClass, ...])

TaskDef is a collection of information about task needed by Pipeline.

TaskError

Use to report errors for which a traceback is not useful.

TaskFactory()

Abstract base class for task factory.

TaskMetadata(*, scalars, ...)

Dict-like object for storing task metadata.

UnprocessableDataError

A specialization of NoWorkFound that will be [subclassed and] raised by Tasks to indicate a failure to process their inputs for some reason that is non-recoverable.

UpstreamFailureNoWorkFound

A specialization of NoWorkFound that indicates that an upstream task had a problem that was ignored (e.g.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.connections.AdjustQuantumHelper, lsst.pipe.base._status.AlgorithmError, lsst.pipe.base._status.AnnotatedPartialOutputsError, lsst.pipe.base.connections.DeferredDatasetRef, lsst.pipe.base._quantumContext.ExecutionResources, lsst.pipe.base._task_metadata.GetDictMetadata, lsst.pipe.base._task_metadata.GetSetDictMetadata, lsst.pipe.base._dataset_handle.InMemoryDatasetHandle, lsst.pipe.base.graph.graph.IncompatibleGraphError, lsst.pipe.base.connections.InputQuantizedConnection, lsst.pipe.base._instrument.Instrument, lsst.pipe.base._status.InvalidQuantumError, lsst.pipe.base.pipeline.LabelSpecifier, lsst.pipe.base._status.NoWorkFound, lsst.pipe.base.graph.quantumNode.NodeId, lsst.pipe.base._observation_dimension_packer.ObservationDimensionPacker, lsst.pipe.base._observation_dimension_packer.ObservationDimensionPackerConfig, lsst.pipe.base.connections.OutputQuantizedConnection, lsst.pipe.base.pipeline.Pipeline, lsst.pipe.base.pipelineTask.PipelineTask, lsst.pipe.base.config.PipelineTaskConfig, lsst.pipe.base.connections.PipelineTaskConnections, lsst.pipe.base.graph.graphSummary.QgraphSummary, lsst.pipe.base.graph.graphSummary.QgraphTaskSummary, lsst.pipe.base.connections.QuantizedConnection, lsst.pipe.base._quantumContext.QuantumContext, lsst.pipe.base.graph.graph.QuantumGraph, lsst.pipe.base.graph.quantumNode.QuantumNode, lsst.pipe.base._status.QuantumSuccessCaveats, lsst.pipe.base._status.RepeatableQuantumError, lsst.pipe.base.connections.ScalarError, lsst.pipe.base._task_metadata.SetDictMetadata, lsst.pipe.base.struct.Struct, lsst.pipe.base.task.Task, lsst.pipe.base.pipeline.TaskDef, lsst.pipe.base.task.TaskError, lsst.pipe.base.taskFactory.TaskFactory, lsst.pipe.base._task_metadata.TaskMetadata, lsst.pipe.base._status.UnprocessableDataError, lsst.pipe.base._status.UpstreamFailureNoWorkFound

lsst.pipe.base.pipeline_graph Package

Functions

compare_packages(packages, new_packages)

Compare two versions of Packages.

log_config_mismatch(msg)

Log messages about configuration mismatch.

Classes

ConnectionTypeConsistencyError

Exception raised when the tasks in a pipeline graph use different (and incompatible) connection types for the same dataset type.

DatasetTypeNode(dataset_type, ...)

A node in a pipeline graph that represents a resolved dataset type.

DuplicateOutputError

Exception raised when multiple tasks in one pipeline produce the same output dataset type.

Edge(*, task_key, dataset_type_key, ...)

Base class for edges in a pipeline graph.

EdgesChangedError

Exception raised when the edges in one version of a pipeline graph are not consistent with those in another, but they were expected to be.

IncompatibleDatasetTypeError

Exception raised when the tasks in a pipeline graph define dataset types with the same name in incompatible ways, or when these are incompatible with the data repository definition.

InvalidStepsError

Exception raised when the step definitions are invalid.

NodeKey(node_type, name)

A special key type for nodes in networkx graphs.

NodeType(value[, names, module, qualname, ...])

Enumeration of the types of nodes in a PipelineGraph.

PipelineDataCycleError

Exception raised when a pipeline graph contains a cycle.

PipelineGraph(*[, description, universe, ...])

A graph representation of fully-configured pipeline.

PipelineGraphError

Base exception raised when there is a problem constructing or resolving a pipeline graph.

PipelineGraphExceptionSafetyError

Exception raised when a PipelineGraph method could not provide strong exception safety, and the graph may have been left in an inconsistent state.

PipelineGraphReadError

Exception raised when a serialized PipelineGraph cannot be read.

ReadEdge(dataset_type_key, task_key, *, ...)

Representation of an input connection (including init-inputs and prerequisites) in a pipeline graph.

StepDefinitions([universe, ...])

A collection of the 'steps' defined in a pipeline graph.

TaskImportMode(value[, names, module, ...])

Enumeration of the ways to handle importing tasks when reading a serialized PipelineGraph.

TaskInitNode(key, *, inputs, outputs, ...[, ...])

A node in a pipeline graph that represents the construction of a PipelineTask.

TaskNode(key, init, *, prerequisite_inputs, ...)

A node in a pipeline graph that represents a labeled configuration of a PipelineTask.

TaskNotImportedError

Exception raised when accessing an attribute of a graph or graph node that is not available unless the task class has been imported and configured.

TaskSubset(parent_xgraph, label, members, ...)

A specialized set that represents a labeled subset of the tasks in a pipeline graph.

UnresolvedGraphError

Exception raised when an operation requires dimensions or dataset types to have been resolved, but they have not been.

WriteEdge(*, task_key, dataset_type_key, ...)

Representation of an output connection (including init-outputs) in a pipeline graph.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.pipeline_graph._exceptions.ConnectionTypeConsistencyError, lsst.pipe.base.pipeline_graph._dataset_types.DatasetTypeNode, lsst.pipe.base.pipeline_graph._exceptions.DuplicateOutputError, lsst.pipe.base.pipeline_graph._edges.Edge, lsst.pipe.base.pipeline_graph._exceptions.EdgesChangedError, lsst.pipe.base.pipeline_graph._exceptions.IncompatibleDatasetTypeError, lsst.pipe.base.pipeline_graph._exceptions.InvalidStepsError, lsst.pipe.base.pipeline_graph._nodes.NodeKey, lsst.pipe.base.pipeline_graph._nodes.NodeType, lsst.pipe.base.pipeline_graph._exceptions.PipelineDataCycleError, lsst.pipe.base.pipeline_graph._pipeline_graph.PipelineGraph, lsst.pipe.base.pipeline_graph._exceptions.PipelineGraphError, lsst.pipe.base.pipeline_graph._exceptions.PipelineGraphExceptionSafetyError, lsst.pipe.base.pipeline_graph._exceptions.PipelineGraphReadError, lsst.pipe.base.pipeline_graph._edges.ReadEdge, lsst.pipe.base.pipeline_graph._task_subsets.StepDefinitions, lsst.pipe.base.pipeline_graph._tasks.TaskImportMode, lsst.pipe.base.pipeline_graph._tasks.TaskInitNode, lsst.pipe.base.pipeline_graph._tasks.TaskNode, lsst.pipe.base.pipeline_graph._exceptions.TaskNotImportedError, lsst.pipe.base.pipeline_graph._task_subsets.TaskSubset, lsst.pipe.base.pipeline_graph._exceptions.UnresolvedGraphError, lsst.pipe.base.pipeline_graph._edges.WriteEdge

lsst.pipe.base.testUtils Module

Functions

assertValidInitOutput(task)

Test that a constructed task conforms to its own init-connections.

assertValidOutput(task, result)

Test that the output of a call to run conforms to its own connections.

getInitInputs(butler, config)

Return the initInputs object that would have been passed to a PipelineTask constructor.

lintConnections(connections, *[, ...])

Inspect a connections class for common errors.

makeQuantum(task, butler, dataId, ioDataIds)

Create a Quantum for a particular data ID(s).

runTestQuantum(task, butler, quantum[, mockRun])

Run a PipelineTask on a Quantum.

lsst.pipe.base.connectionTypes Module

Module defining connection types to be used within a PipelineTaskConnections class.

Classes

BaseConnection(name, storageClass[, doc, ...])

Base class used for declaring PipelineTask connections.

InitInput(name, storageClass[, doc, ...])

Connection for initInput dataset.

InitOutput(name, storageClass[, doc, ...])

Connection for initOutput dataset.

Input(name, storageClass[, doc, multiple, ...])

Class used for declaring PipelineTask input connections.

Output(name, storageClass[, doc, multiple, ...])

Connection for output dataset.

PrerequisiteInput(name, storageClass[, doc, ...])

Class used for declaring PipelineTask prerequisite connections.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.connectionTypes.BaseConnection, lsst.pipe.base.connectionTypes.InitInput, lsst.pipe.base.connectionTypes.InitOutput, lsst.pipe.base.connectionTypes.Input, lsst.pipe.base.connectionTypes.Output, lsst.pipe.base.connectionTypes.PrerequisiteInput

lsst.pipe.base.pipelineIR Module

Classes

ConfigIR(python, dataId, file, rest)

Intermediate representation of configurations read from a pipeline yaml file.

ContractError

An exception that is raised when a pipeline contract is not satisfied.

ContractIR(contract[, msg])

Intermediate representation of configuration contracts read from a pipeline yaml file.

ImportIR(location, include, exclude, ...)

An intermediate representation of imported pipelines.

LabeledSubset(label, subset, description)

Intermediate representation of named subset of task labels read from a pipeline yaml file.

ParametersIR(mapping)

Intermediate representation of parameters that are global to a pipeline.

PipelineIR(loaded_yaml)

Intermediate representation of a pipeline definition.

TaskIR(label, klass[, config])

Intermediate representation of tasks read from a pipeline yaml file.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.pipelineIR.ConfigIR, lsst.pipe.base.pipelineIR.ContractError, lsst.pipe.base.pipelineIR.ContractIR, lsst.pipe.base.pipelineIR.ImportIR, lsst.pipe.base.pipelineIR.LabeledSubset, lsst.pipe.base.pipelineIR.ParametersIR, lsst.pipe.base.pipelineIR.PipelineIR, lsst.pipe.base.pipelineIR.TaskIR

lsst.pipe.base.tests.mocks Package

A system for replacing the tasks in a pipeline with mocks that just read and write trivial datasets.

See Testing pipelines with mocks for details.

Functions

get_mock_name(original)

Return the name of the mock storage class, dataset type, or task label for the given original name.

get_original_name(mock)

Return the name of the original storage class, dataset type, or task label that corresponds to the given mock name.

is_mock_name(name)

Return whether the given name is that of a mock storage class, dataset type, or task label.

mock_pipeline_graph(original_graph[, ...])

Create mocks for a full pipeline graph.

Classes

ConvertedUnmockedDataset(*, original_type)

A marker class that represents a conversion from a regular in-memory dataset to a mock storage class.

DataIdMatch(expression)

Class that can match DataId against the user-defined string expression.

DynamicConnectionConfig(*args, **kw)

A config class that defines a completely dynamic connection.

DynamicTestPipelineTask(*, config, ...)

A test-utility implementation of PipelineTask with dimensions and connections determined wholly from configuration.

DynamicTestPipelineTaskConfig(*args, **kw)

Configuration for DynamicTestPipelineTask.

ForcedFailure(condition[, exception_type, ...])

Information about an exception that should be raised by one or more quanta.

MockAlgorithmError

A subclass of AlgorithmError chained to AnnotatedPartialOutputsError when the latter is configured to be raised by MockPipelineTask.

MockDataset(*, dataset_id, dataset_type, ...)

The in-memory dataset type used by MockStorageClass.

MockDatasetQuantum(*, task_label, data_id, ...)

Description of the quantum that produced a mock dataset.

MockPipelineTask(*, config, initInputs, **kwargs)

A test-utility implementation of PipelineTask with connections generated by mocking those of a real task.

MockPipelineTaskConfig(*args, **kw)

Configuration class for MockPipelineTask.

MockStorageClass(original[, factory])

A reimplementation of lsst.daf.butler.StorageClass for mock datasets.

MockStorageClassDelegate(storageClass)

Implementation of the StorageClassDelegate interface for mock datasets.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.tests.mocks._storage_class.ConvertedUnmockedDataset, lsst.pipe.base.tests.mocks._data_id_match.DataIdMatch, lsst.pipe.base.tests.mocks._pipeline_task.DynamicConnectionConfig, lsst.pipe.base.tests.mocks._pipeline_task.DynamicTestPipelineTask, lsst.pipe.base.tests.mocks._pipeline_task.DynamicTestPipelineTaskConfig, lsst.pipe.base.tests.mocks._pipeline_task.ForcedFailure, lsst.pipe.base.tests.mocks._pipeline_task.MockAlgorithmError, lsst.pipe.base.tests.mocks._storage_class.MockDataset, lsst.pipe.base.tests.mocks._storage_class.MockDatasetQuantum, lsst.pipe.base.tests.mocks._pipeline_task.MockPipelineTask, lsst.pipe.base.tests.mocks._pipeline_task.MockPipelineTaskConfig, lsst.pipe.base.tests.mocks._storage_class.MockStorageClass, lsst.pipe.base.tests.mocks._storage_class.MockStorageClassDelegate

lsst.pipe.base.execution_reports Module

Functions

lookup_quantum_data_id(graph_uri, nodes)

Look up a dataId from a quantum graph and a list of quantum graph nodeIDs.

Classes

DatasetTypeExecutionReport(failed, ...)

A report on the number of produced datasets as well as the status of missing datasets based on metadata.

QuantumGraphExecutionReport(tasks, ...)

A report on the execution of a quantum graph.

TaskExecutionReport(failed, ...)

A report on the status and content of a task in an executed quantum graph.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.execution_reports.DatasetTypeExecutionReport, lsst.pipe.base.execution_reports.QuantumGraphExecutionReport, lsst.pipe.base.execution_reports.TaskExecutionReport

QuantumGraph generation API reference

lsst.pipe.base.quantum_graph_builder Module

The base class for the QuantumGraph-generation algorithm and various helper classes.

Classes

EmptyDimensionsDatasets(inputs, ...)

Struct that holds the results of empty-dimensions dataset queries for QuantumGraphBuilder.

OutputExistsError

Exception generated when output datasets already exist.

PrerequisiteMissingError

Exception generated when a prerequisite dataset does not exist.

QuantumGraphBuilder(pipeline_graph, butler, *)

An abstract base class for building QuantumGraph objects from a pipeline.

QuantumGraphBuilderError

Base class for exceptions generated by QuantumGraphBuilder.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.quantum_graph_builder.EmptyDimensionsDatasets, lsst.pipe.base.quantum_graph_builder.OutputExistsError, lsst.pipe.base.quantum_graph_builder.PrerequisiteMissingError, lsst.pipe.base.quantum_graph_builder.QuantumGraphBuilder, lsst.pipe.base.quantum_graph_builder.QuantumGraphBuilderError

lsst.pipe.base.quantum_graph_skeleton Module

An under-construction version of QuantumGraph and various helper classes.

Classes

DatasetKey(parent_dataset_type_name, ...)

Identifier type for dataset keys in a QuantumGraphSkeleton.

PrerequisiteDatasetKey(...)

Identifier type for prerequisite dataset keys in a QuantumGraphSkeleton.

QuantumGraphSkeleton(task_labels)

An under-construction quantum graph.

QuantumKey(task_label, data_id_values)

Identifier type for quantum keys in a QuantumGraphSkeleton.

TaskInitKey(task_label)

Identifier type for task init keys in a QuantumGraphSkeleton.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.quantum_graph_skeleton.DatasetKey, lsst.pipe.base.quantum_graph_skeleton.PrerequisiteDatasetKey, lsst.pipe.base.quantum_graph_skeleton.QuantumGraphSkeleton, lsst.pipe.base.quantum_graph_skeleton.QuantumKey, lsst.pipe.base.quantum_graph_skeleton.TaskInitKey

lsst.pipe.base.prerequisite_helpers Module

Helper classes for finding prerequisite input datasets during QuantumGraph generation.

Classes

PrerequisiteBounds(task_node, ...)

A QuantumGraph-generation helper class that manages the spatial and temporal bounds of a tasks' quanta, for the purpose of finding prerequisite inputs.

PrerequisiteFinder(edge, bounds, pipeline_graph)

A QuantumGraph-generation helper class that manages the searches for a prerequisite input connection.

PrerequisiteInfo(task_node, pipeline_graph)

A QuantumGraph-generation helper class that manages the searches for all prerequisite input connections for a task.

SkyPixBoundsBuilder()

A base class for objects that accumulate the appropriate spatial bounds for a quantum.

TimespanBuilder()

A base class for objects that accumulate the appropriate timespan for a quantum.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.prerequisite_helpers.PrerequisiteBounds, lsst.pipe.base.prerequisite_helpers.PrerequisiteFinder, lsst.pipe.base.prerequisite_helpers.PrerequisiteInfo, lsst.pipe.base.prerequisite_helpers.SkyPixBoundsBuilder, lsst.pipe.base.prerequisite_helpers.TimespanBuilder

lsst.pipe.base.all_dimensions_quantum_graph_builder Module

The standard, general-purpose implementation of the QuantumGraph-generation algorithm.

Classes

AllDimensionsQuantumGraphBuilder(...)

An implementation of QuantumGraphBuilder that uses a single large query for data IDs covering all dimensions in the pipeline.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base.all_dimensions_quantum_graph_builder.AllDimensionsQuantumGraphBuilder

lsst.pipe.base._datasetQueryConstraints Module

Symbols defined in this package should be imported from all_dimensions_quantum_graph_builder instead; it only appears in the docs due to limitations in Sphinx.

Classes

DatasetQueryConstraintVariant()

Base for all the valid variants for controlling constraining graph building queries based on dataset type existence.

Class Inheritance Diagram

Inheritance diagram of lsst.pipe.base._datasetQueryConstraints.DatasetQueryConstraintVariant