Thrown if a file/directory is specified as an output in more than one stage. Args: output (unicode): path to the file/directory. stages (list): list of paths to stages.
| 27 | |
| 28 | |
| 29 | class OutputDuplicationError(DvcException): |
| 30 | """Thrown if a file/directory is specified as an output in more than one |
| 31 | stage. |
| 32 | |
| 33 | Args: |
| 34 | output (unicode): path to the file/directory. |
| 35 | stages (list): list of paths to stages. |
| 36 | """ |
| 37 | |
| 38 | def __init__(self, output: str, stages: set["Stage"]): |
| 39 | from funcy import first |
| 40 | |
| 41 | assert isinstance(output, str) |
| 42 | assert all(hasattr(stage, "relpath") for stage in stages) |
| 43 | if len(stages) == 1: |
| 44 | stage = first(stages) |
| 45 | msg = ( |
| 46 | f"output '{output}' is already specified in {stage}." |
| 47 | f"\nUse `dvc remove {stage.addressing}` to stop tracking the " |
| 48 | "overlapping output." |
| 49 | ) |
| 50 | else: |
| 51 | stage_names = "\n".join(["\t- " + s.addressing for s in stages]) |
| 52 | msg = ( |
| 53 | f"output '{output}' is specified in:\n{stage_names}" |
| 54 | "\nUse `dvc remove` with any of the above targets to stop tracking the " |
| 55 | "overlapping output." |
| 56 | ) |
| 57 | super().__init__(msg) |
| 58 | self.stages = stages |
| 59 | self.output = output |
| 60 | |
| 61 | |
| 62 | class OutputNotFoundError(DvcException): |
no outgoing calls
no test coverage detected