Skip to content

Commit

Permalink
Add Pipeline.task_labels property
Browse files Browse the repository at this point in the history
This provides a way to get the labels of the tasks without the
expensive (and not-always-possible) step of making a PipelineGraph.
  • Loading branch information
TallJimbo committed Mar 28, 2024
1 parent 692638f commit 74eec4f
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions python/lsst/pipe/base/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -596,6 +596,17 @@ def findSubsetsWithLabel(self, label: str) -> set[str]:
results.add(subset.label)
return results

@property
def task_labels(self) -> Set[str]:
"""Labels of all tasks in the pipelines.
For simple pipelines with no imports, iteration over this set will
match the order in which tasks are defined in the pipeline file. In
all other cases the order is unspecified but deterministic. It is not
dependency-ordered (use ``to_graph().tasks.keys()`` for that).
"""
return self._pipelineIR.tasks.keys()

Check warning on line 608 in python/lsst/pipe/base/pipeline.py

View check run for this annotation

Codecov / codecov/patch

python/lsst/pipe/base/pipeline.py#L608

Added line #L608 was not covered by tests

@property
def subsets(self) -> MappingProxyType[str, set]:
"""Returns a `MappingProxyType` where the keys are the labels of
Expand Down

0 comments on commit 74eec4f

Please sign in to comment.