(self)
| 11 | |
| 12 | class CmdExperimentsDiff(CmdBase): |
| 13 | def run(self): |
| 14 | try: |
| 15 | diff = self.repo.experiments.diff( |
| 16 | a_rev=self.args.a_rev, |
| 17 | b_rev=self.args.b_rev, |
| 18 | all=self.args.all, |
| 19 | param_deps=self.args.param_deps, |
| 20 | ) |
| 21 | except DvcException: |
| 22 | logger.exception("failed to show experiments diff") |
| 23 | return 1 |
| 24 | |
| 25 | if self.args.json: |
| 26 | ui.write_json(diff) |
| 27 | elif diff: |
| 28 | from dvc.compare import show_diff |
| 29 | |
| 30 | precision = self.args.precision or DEFAULT_PRECISION |
| 31 | diffs = [("metrics", "Metric"), ("params", "Param")] |
| 32 | for idx, (key, title) in enumerate(diffs): |
| 33 | if idx: |
| 34 | # we are printing tables even in `--quiet` mode |
| 35 | # so we should also be printing the "table" separator |
| 36 | ui.write(force=True) |
| 37 | |
| 38 | show_diff( |
| 39 | diff[key], |
| 40 | title=title, |
| 41 | markdown=self.args.markdown, |
| 42 | no_path=self.args.no_path, |
| 43 | on_empty_diff="diff not supported", |
| 44 | precision=precision if key == "metrics" else None, |
| 45 | a_rev=self.args.a_rev, |
| 46 | b_rev=self.args.b_rev, |
| 47 | ) |
| 48 | |
| 49 | return 0 |
| 50 | |
| 51 | |
| 52 | def add_parser(experiments_subparsers, parent_parser): |
nothing calls this directly
no test coverage detected