Edge

class lsst.pipe.base.pipeline_graph.Edge(*, task_key: NodeKey, dataset_type_key: NodeKey, storage_class_name: str, connection_name: str, is_calibration: bool, raw_dimensions: frozenset[str])

Bases: ABC

Base class for edges in a pipeline graph.

This represents the link between a task node and an input or output dataset type.

Parameters:
task_keyNodeKey

Key for the task node this edge is connected to.

dataset_type_keyNodeKey

Key for the dataset type node this edge is connected to.

storage_class_namestr

Name of the dataset type’s storage class as seen by the task.

connection_namestr

Internal name for the connection as seen by the task.

is_calibrationbool

Whether this dataset type can be included in CALIBRATION collections.

raw_dimensionsfrozenset [ str ]

Raw dimensions from the connection definition.

Attributes Summary

INIT_TO_TASK_NAME

Edge key for the special edge that connects a task init node to the task node itself (for regular edges, this would be the connection name).

dataset_type_name

Dataset type name seen by the task.

is_init

Whether this dataset is read or written when the task is constructed, not when it is run.

key

Ordered tuple of node keys and connection name that uniquely identifies this edge in a pipeline graph.

nodes

The directed pair of NodeKey instances this edge connects.

parent_dataset_type_name

Name of the parent dataset type.

task_label

Label of the task.

Methods Summary

adapt_dataset_ref(ref)

Transform the graph's definition of a dataset reference (parent dataset type, with the registry or producer's storage class) to the one seen by this task.

adapt_dataset_type(dataset_type)

Transform the graph's definition of a dataset type (parent, with the registry or producer's storage class) to the one seen by this task.

diff(other[, connection_type])

Compare this edge to another one from a possibly-different configuration of the same task label.

Attributes Documentation

INIT_TO_TASK_NAME: ClassVar[str] = 'INIT'

Edge key for the special edge that connects a task init node to the task node itself (for regular edges, this would be the connection name).

dataset_type_name

Dataset type name seen by the task.

This defaults to the parent dataset type name, which is appropriate for all writes and most reads.

is_init

Whether this dataset is read or written when the task is constructed, not when it is run.

key

Ordered tuple of node keys and connection name that uniquely identifies this edge in a pipeline graph.

nodes

The directed pair of NodeKey instances this edge connects.

This tuple is ordered in the same direction as the pipeline flow: task_key precedes dataset_type_key for writes, and the reverse is true for reads.

parent_dataset_type_name

Name of the parent dataset type.

All dataset type nodes in a pipeline graph are for parent dataset types; components are represented by additional ReadEdge state.

task_label

Label of the task.

Methods Documentation

abstract adapt_dataset_ref(ref: DatasetRef) DatasetRef

Transform the graph’s definition of a dataset reference (parent dataset type, with the registry or producer’s storage class) to the one seen by this task.

abstract adapt_dataset_type(dataset_type: DatasetType) DatasetType

Transform the graph’s definition of a dataset type (parent, with the registry or producer’s storage class) to the one seen by this task.

diff(other: _S, connection_type: str = 'connection') list[str]

Compare this edge to another one from a possibly-different configuration of the same task label.

Parameters:
otherEdge

Another edge of the same type to compare to.

connection_typestr

Human-readable name of the connection type of this edge (e.g. “init input”, “output”) for use in returned messages.

Returns:
differenceslist [ str ]

List of string messages describing differences between self and other. Will be empty if self == other or if the only difference is in the task label or connection name (which are not checked). Messages will use ‘A’ to refer to self and ‘B’ to refer to other.