TaskInitNode

class lsst.pipe.base.pipeline_graph.TaskInitNode(key: NodeKey, *, inputs: Mapping[str, ReadEdge], outputs: Mapping[str, WriteEdge], config_output: WriteEdge, imported_data: _TaskNodeImportedData | None = None, task_class_name: str | None = None, config_str: str | None = None)

Bases: object

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

Parameters:
keyNodeKey

Key that identifies this node in internal and exported networkx graphs.

inputsMapping [ str, ReadEdge ]

Graph edges that represent inputs required just to construct an instance of this task, keyed by connection name.

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

Graph edges that represent outputs of this task that are available after just constructing it, keyed by connection name.

This does not include the special config_init_output edge; use iter_all_outputs to include that, too.

config_outputWriteEdge

The special init output edge that persists the task’s configuration.

imported_data_TaskNodeImportedData, optional

Internal struct that holds information that requires the task class to have been be imported.

task_class_namestr, optional

Fully-qualified name of the task class. Must be provided if imported_data is not.

config_strstr, optional

Configuration for the task as a string of override statements. Must be provided if imported_data is not.

Notes

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

  • task_class_name

  • bipartite (see NodeType.bipartite)

  • task_class (only if is_imported is True)

  • config (only if is_importd is True)

Attributes Summary

config

Configuration for the task.

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.

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 initialization 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.

iter_all_inputs()

Iterate over all inputs required for construction.

iter_all_outputs()

Iterate over all outputs available after construction, 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.

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.

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: TaskInitNode) list[str]

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

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.

iter_all_inputs() Iterator[ReadEdge]

Iterate over all inputs required for construction.

This is the same as iteration over inputs.values(), but it will be updated to include any automatic init-input connections added in the future, while inputs will continue to hold only task-defined init inputs.

Yields:
ReadEdge

All the inputs required for construction.

iter_all_outputs() Iterator[WriteEdge]

Iterate over all outputs available after construction, including special ones.

Yields:
ReadEdge

All the outputs available after construction.