MCPcopy
hub / github.com/treeverse/dvc / OutputDuplicationError

Class OutputDuplicationError

dvc/exceptions.py:29–59  ·  view source on GitHub ↗

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.

Source from the content-addressed store, hash-verified

27
28
29class 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
62class OutputNotFoundError(DvcException):

Callers 5

imp_urlFunction · 0.90
createMethod · 0.90
build_outs_trieFunction · 0.90
translate_graph_errorFunction · 0.90
imp_dbFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected