TaskNode

class lsst.pipe.base.pipeline_graph.TaskNode(key: NodeKey, init: TaskInitNode, *, prerequisite_inputs: Mapping[str, ReadEdge], inputs: Mapping[str, ReadEdge], outputs: Mapping[str, WriteEdge], log_output: WriteEdge | None, metadata_output: WriteEdge, dimensions: DimensionGroup | frozenset[str])

Bases: object

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

Parameters:
keyNodeKey

Identifier for this node in networkx graphs.

initTaskInitNode

Node representing the initialization of this task.

prerequisite_inputsMapping [ str, ReadEdge ]

Graph edges that represent prerequisite inputs to this task, keyed by connection name.

Prerequisite inputs must already exist in the data repository when a QuantumGraph is built, but have more flexibility in how they are looked up than regular inputs.

inputsMapping [ str, ReadEdge ]

Graph edges that represent regular runtime inputs to this task, keyed by connection name.

outputs~collections.abc.Mapping` [ str, WriteEdge ]

Graph edges that represent regular runtime outputs of this task, keyed by connection name.

This does not include the special log_output and metadata_output edges; use iter_all_outputs to include that, too.

log_outputWriteEdge or None

The special runtime output that persists the task’s logs.

metadata_outputWriteEdge

The special runtime output that persists the task’s metadata.

dimensionslsst.daf.butler.DimensionGroup or frozenset [ str ]

Dimensions of the task. If a frozenset, the dimensions have not been resolved by a DimensionUniverse and cannot be safely compared to other sets of dimensions.

Notes

Task nodes are intentionally not equality comparable, since there are many different (and useful) ways to compare these objects with no clear winner as the most obvious behavior.

When included in an exported networkx graph (e.g. PipelineGraph.make_xgraph), task nodes set the following node attributes:

Attributes Summary

config

Configuration for the task.

dimensions

Standardized dimensions of the task.

has_resolved_dimensions

Whether the dimensions attribute may be accessed.

is_imported

Whether this the task type for this node has been imported and its configuration overrides applied.

label

Label of this configuration of a task in the pipeline.

raw_dimensions

Raw dimensions of the task, with standardization by a DimensionUniverse not guaranteed.

task_class

Type object for the task.

task_class_name

The fully-qualified string name of the task class.

Methods Summary

diff_edges(other)

Compare the edges of this task node to those from the same task label in a different pipeline.

get_config_str()

Return the configuration for this task as a string of override statements.

get_connections()

Return the connections class instance for this task.

get_lookup_function(connection_name)

Return the custom dataset query function for an edge, if one exists.

get_spatial_bounds_connections()

Return the names of connections whose data IDs should be included in the calculation of the spatial bounds for this task's quanta.

get_temporal_bounds_connections()

Return the names of connections whose data IDs should be included in the calculation of the temporal bounds for this task's quanta.

iter_all_inputs()

Iterate over all runtime inputs, including both regular inputs and prerequisites.

iter_all_outputs()

Iterate over all runtime outputs, including special ones.

Attributes Documentation

config

Configuration for the task.

This is always frozen.

Accessing this attribute when is_imported is False will raise TaskNotImportedError, but calling get_config_str will not.

dimensions

Standardized dimensions of the task.

has_resolved_dimensions

Whether the dimensions attribute may be accessed.

If False, the raw_dimensions attribute may be used to obtain a set of dimension names that has not been resolved by a DimensionsUniverse.

is_imported

Whether this the task type for this node has been imported and its configuration overrides applied.

If this is False, the task_class and config attributes may not be accessed.

label

Label of this configuration of a task in the pipeline.

raw_dimensions

Raw dimensions of the task, with standardization by a DimensionUniverse not guaranteed.

task_class

Type object for the task.

Accessing this attribute when is_imported is False will raise TaskNotImportedError, but accessing task_class_name will not.

task_class_name

The fully-qualified string name of the task class.

Methods Documentation

diff_edges(other: TaskNode) list[str]

Compare the edges of this task node to those from the same task label in a different pipeline.

This also calls TaskInitNode.diff_edges.

Parameters:
otherTaskInitNode

Other node to compare to. Must have the same task label, but need not have the same configuration or even the same task class.

Returns:
differenceslist [ str ]

List of string messages describing differences between self and other. Will be empty if the two nodes have the same edges. Messages will use ‘A’ to refer to self and ‘B’ to refer to other.

get_config_str() str

Return the configuration for this task as a string of override statements.

Returns:
config_strstr

String containing configuration-overload statements.

get_connections() PipelineTaskConnections

Return the connections class instance for this task.

Returns:
connectionsPipelineTaskConnections

Task-provided object that defines inputs and outputs from configuration.

get_lookup_function(connection_name: str) Callable[[DatasetType, Registry, DataCoordinate, Sequence[str]], Iterable[DatasetRef]] | None

Return the custom dataset query function for an edge, if one exists.

Parameters:
connection_namestr

Name of the connection.

Returns:
lookup_functionCallable or None

Callable that takes a dataset type, a butler registry, a data coordinate (the quantum data ID), and an ordered list of collections to search, and returns an iterable of DatasetRef.

get_spatial_bounds_connections() frozenset[str]

Return the names of connections whose data IDs should be included in the calculation of the spatial bounds for this task’s quanta.

Returns:
connection_namesfrozenset [ str ]

Names of connections with spatial dimensions.

get_temporal_bounds_connections() frozenset[str]

Return the names of connections whose data IDs should be included in the calculation of the temporal bounds for this task’s quanta.

Returns:
connection_namesfrozenset [ str ]

Names of connections with temporal dimensions.

iter_all_inputs() Iterator[ReadEdge]

Iterate over all runtime inputs, including both regular inputs and prerequisites.

Yields:
ReadEdge

All the runtime inputs.

iter_all_outputs() Iterator[WriteEdge]

Iterate over all runtime outputs, including special ones.

Yields:
ReadEdge

All the runtime outputs.