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

Method run

dvc/commands/params.py:13–51  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

11 UNINITIALIZED = True
12
13 def run(self):
14 import os
15 from os.path import relpath
16
17 diff_result = self.repo.params.diff(
18 a_rev=self.args.a_rev,
19 b_rev=self.args.b_rev,
20 targets=self.args.targets,
21 all=self.args.all,
22 deps_only=self.args.deps,
23 )
24
25 errored = [rev for rev, err in diff_result.get("errors", {}).items() if err]
26 if errored:
27 ui.error_write(
28 "DVC failed to load some metrics for following revisions:"
29 f" '{', '.join(errored)}'."
30 )
31
32 start = relpath(os.getcwd(), self.repo.root_dir)
33 diff = diff_result.get("diff", {})
34 diff = {relpath(path, start): result for path, result in diff.items()}
35
36 if self.args.json:
37 ui.write_json(diff)
38 else:
39 from dvc.compare import show_diff
40
41 show_diff(
42 diff,
43 title="Param",
44 markdown=self.args.markdown,
45 no_path=self.args.no_path,
46 show_changes=False,
47 a_rev=self.args.a_rev,
48 b_rev=self.args.b_rev,
49 )
50
51 return 0
52
53
54def add_parser(subparsers, parent_parser):

Callers

nothing calls this directly

Calls 9

show_diffFunction · 0.90
relpathFunction · 0.85
itemsMethod · 0.80
error_writeMethod · 0.80
joinMethod · 0.80
write_jsonMethod · 0.80
diffMethod · 0.45
getMethod · 0.45
getcwdMethod · 0.45

Tested by

no test coverage detected