PipelineIR¶
-
class
lsst.pipe.base.pipelineIR.PipelineIR(loaded_yaml: Dict[str, Any])¶ Bases:
objectIntermediate 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
Raised if: - a pipeline is declared without a description; - no tasks are declared in a pipeline, and no pipelines are to be
inherited;
- more than one instrument is specified;
- more than one inherited pipeline share a label.
Methods Summary
from_file(filename)Create a PipelineIRobject from the document specified by thefrom_string(pipeline_string)Create a PipelineIRobject from a string formatted like a pipeline documentfrom_uri(uri, urllib.parse.ParseResult, …)Create a PipelineIRobject from the document specified by the input uri.reorder_tasks(task_labels)Changes the order tasks are stored internally. subset_from_labels(labelSpecifier)Subset a pipelineIR to contain only labels specified in labelSpecifier. to_file(filename)Serialize this PipelineIRobject into a yaml formatted string andto_primitives()Convert to a representation used in yaml serialization write_to_uri(uri, urllib.parse.ParseResult, …)Serialize this PipelineIRobject into a yaml formatted string and write the output to a file at the specified uri.Methods Documentation
-
classmethod
from_file(filename: str) → lsst.pipe.base.pipelineIR.PipelineIR¶ - Create a
PipelineIRobject from the document specified by the - input path.
Parameters: - filename :
str Location of document to use in creating a
PipelineIRobject.
Returns: - pipelineIR :
PipelineIR The loaded pipeline
Deprecated since version v21.0,: This has been replaced with
from_uri. will be removed after v23- Create a
-
classmethod
from_string(pipeline_string: str) → lsst.pipe.base.pipelineIR.PipelineIR¶ Create a
PipelineIRobject from a string formatted like a pipeline documentParameters: - pipeline_string :
str A string that is formatted according like a pipeline document
- pipeline_string :
-
classmethod
from_uri(uri: Union[str, urllib.parse.ParseResult, lsst.resources._resourcePath.ResourcePath, pathlib.Path]) → lsst.pipe.base.pipelineIR.PipelineIR¶ Create a
PipelineIRobject from the document specified by the input uri.Parameters: - uri: convertible to `ResourcePath`
Location of document to use in creating a
PipelineIRobject.
Returns: - pipelineIR :
PipelineIR The loaded pipeline
-
reorder_tasks(task_labels: List[str]) → None¶ Changes the order tasks are stored internally. Useful for determining the order things will appear in the serialized (or printed) form.
Parameters: Raises: - KeyError
Raised if labels are supplied that are not in the pipeline, or if not all labels in the pipeline were supplied in task_labels input.
-
subset_from_labels(labelSpecifier: Set[str]) → lsst.pipe.base.pipelineIR.PipelineIR¶ Subset a pipelineIR to contain only labels specified in labelSpecifier.
Parameters: 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.
- pipeline :
-
to_file(filename: str)¶ - Serialize this
PipelineIRobject 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
PipelineIRobject.- .. deprecated:: v21.0,
This has been replaced with
write_to_uri. will be removed after v23
- Serialize this
-
to_primitives() → Dict[str, Any]¶ Convert to a representation used in yaml serialization
-
write_to_uri(uri: Union[str, urllib.parse.ParseResult, lsst.resources._resourcePath.ResourcePath, pathlib.Path]) → None¶ Serialize this
PipelineIRobject into a yaml formatted string and write the output to a file at the specified uri.Parameters: - uri: convertible to `ResourcePath`
Location of document to write a
PipelineIRobject.
- loaded_yaml :