PipelineIR

class lsst.pipe.base.pipelineIR.PipelineIR(loaded_yaml)

Bases: object

Intermediate representation of a pipeline definition

Parameters:
loaded_yaml : dict

A dictionary which matches the structure that would be produced by a yaml reader which parses a pipeline definition document

Raises:
ValueError :
  • If a pipeline is declared without a description
  • If no tasks are declared in a pipeline, and no pipelines are to be inherited
  • If more than one instrument is specified
  • If more than one inherited pipeline share a label

Methods Summary

from_file(filename) Create a PipelineIR object from the document specified by the input path.
from_string(pipeline_string) Create a PipelineIR object from a string formatted like a pipeline document
subset_from_labels(labelSpecifier) Subset a pipelineIR to contain only labels specified in labelSpecifier.
to_file(filename) Serialize this PipelineIR object into a yaml formatted string and write the output to a file at the specified path.
to_primitives() Convert to a representation used in yaml serialization

Methods Documentation

classmethod from_file(filename: str)

Create a PipelineIR object from the document specified by the input path.

Parameters:
filename : str

Location of document to use in creating a PipelineIR object.

classmethod from_string(pipeline_string: str)

Create a PipelineIR object from a string formatted like a pipeline document

Parameters:
pipeline_string : str

A string that is formatted according like a pipeline document

subset_from_labels(labelSpecifier: Set[str]) → lsst.pipe.base.pipelineIR.PipelineIR

Subset a pipelineIR to contain only labels specified in labelSpecifier.

Parameters:
labelSpecifier : set of str

Set containing labels that describes how to subset a pipeline.

Returns:
pipeline : PipelineIR

A new pipelineIR object that is a subset of the old pipelineIR

Raises:
ValueError

Raised if there is an issue with specified labels

Notes

This method attempts to prune any contracts that contain labels which are not in the declared subset of labels. This pruning is done using a string based matching due to the nature of contracts and may prune more than it should. Any labeled subsets defined that no longer have all members of the subset present in the pipeline will be removed from the resulting pipeline.

to_file(filename: str)

Serialize this PipelineIR object into a yaml formatted string and write the output to a file at the specified path.

Parameters:
filename : str

Location of document to write a PipelineIR object.

to_primitives()

Convert to a representation used in yaml serialization