Skip to content

Commit

Permalink
Include duplicated task labels in exception message
Browse files Browse the repository at this point in the history
  • Loading branch information
parejkoj committed Jun 8, 2021
1 parent 94ff9f4 commit dd2b4cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion python/lsst/pipe/base/pipelineIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,10 @@ def process_args(argument: Union[str, dict]) -> dict:
f"Top level pipeline defines {self.instrument} but {other_pipeline.location} "
f"defines {tmp_IR.instrument}.")
raise ValueError(msg)
"be unique")
if duplicate_labels := accumulate_tasks.keys() & tmp_IR.tasks.keys():
msg = ("Task labels in the imported pipelines must be unique. "
f"These labels appear multiple times: {duplicate_labels}")
raise ValueError(msg)
accumulate_tasks.update(tmp_IR.tasks)
self.contracts.extend(tmp_IR.contracts)
# verify that tmp_IR has unique labels for named subset among
Expand Down
4 changes: 2 additions & 2 deletions tests/test_pipelineIR.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ def testImportParsing(self):
- $PIPE_BASE_DIR/tests/testPipeline1.yaml
- $PIPE_BASE_DIR/tests/testPipeline2.yaml
""")

with self.assertRaises(ValueError):
# "modA" is the duplicated label, and it should appear in the error.
with self.assertRaisesRegex(ValueError, "modA"):
PipelineIR.from_string(pipeline_str)

# This should pass, as the conflicting task is excluded
Expand Down

0 comments on commit dd2b4cf

Please sign in to comment.