From 31e4a3325dfb9b7fda8d6892ba9a548a74dab43f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Redzy=C5=84ski?= Date: Tue, 2 Feb 2021 13:44:38 +0100 Subject: [PATCH] live integration: rename report to html (#5366) --- dvc/command/run.py | 2 +- dvc/command/stage.py | 2 +- dvc/env.py | 2 +- dvc/output/base.py | 2 +- dvc/schema.py | 2 +- dvc/stage/__init__.py | 6 +++--- dvc/stage/utils.py | 6 +++--- tests/func/test_live.py | 18 +++++++++--------- tests/unit/command/test_run.py | 8 ++++---- tests/unit/command/test_stage.py | 4 ++-- 10 files changed, 26 insertions(+), 26 deletions(-) diff --git a/dvc/command/run.py b/dvc/command/run.py index 376e7a977..ac548ca8a 100644 --- a/dvc/command/run.py +++ b/dvc/command/run.py @@ -44,7 +44,7 @@ class CmdRun(CmdBase): plots_no_cache=self.args.plots_no_cache, live=self.args.live, live_no_summary=self.args.live_no_summary, - live_no_report=self.args.live_no_report, + live_no_html=self.args.live_no_html, deps=self.args.deps, params=self.args.params, fname=self.args.file, diff --git a/dvc/command/stage.py b/dvc/command/stage.py index 9fbaf09a3..488468b02 100644 --- a/dvc/command/stage.py +++ b/dvc/command/stage.py @@ -213,7 +213,7 @@ def _add_common_args(parser): help="Signal dvclive logger to not dump latest metrics file.", ) parser.add_argument( - "--live-no-report", + "--live-no-html", action="store_true", default=False, help="Signal dvclive logger to not produce training report.", diff --git a/dvc/env.py b/dvc/env.py index 9d2162c98..299ab711c 100644 --- a/dvc/env.py +++ b/dvc/env.py @@ -4,5 +4,5 @@ DVC_PAGER = "DVC_PAGER" DVC_ROOT = "DVC_ROOT" DVCLIVE_PATH = "DVCLIVE_PATH" DVCLIVE_SUMMARY = "DVCLIVE_SUMMARY" -DVCLIVE_REPORT = "DVCLIVE_REPORT" +DVCLIVE_HTML = "DVCLIVE_HTML" DVCLIVE_RESUME = "DVCLIVE_RESUME" diff --git a/dvc/output/base.py b/dvc/output/base.py index 7242e8478..49f2a6a75 100644 --- a/dvc/output/base.py +++ b/dvc/output/base.py @@ -79,7 +79,7 @@ class BaseOutput: PARAM_ISEXEC = "isexec" PARAM_LIVE = "live" PARAM_LIVE_SUMMARY = "summary" - PARAM_LIVE_REPORT = "report" + PARAM_LIVE_HTML = "html" METRIC_SCHEMA = Any( None, diff --git a/dvc/schema.py b/dvc/schema.py index 48baa6123..bf7025ae6 100644 --- a/dvc/schema.py +++ b/dvc/schema.py @@ -69,7 +69,7 @@ PLOT_PSTAGE_SCHEMA = {str: Any(PLOT_PROPS_SCHEMA, [PLOT_PROPS_SCHEMA])} LIVE_PROPS = { BaseOutput.PARAM_LIVE_SUMMARY: bool, - BaseOutput.PARAM_LIVE_REPORT: bool, + BaseOutput.PARAM_LIVE_HTML: bool, } LIVE_PROPS_SCHEMA = {**PLOT_PROPS_SCHEMA, **LIVE_PROPS} LIVE_PSTAGE_SCHEMA = {str: LIVE_PROPS_SCHEMA} diff --git a/dvc/stage/__init__.py b/dvc/stage/__init__.py index 261b572c1..ccc320b70 100644 --- a/dvc/stage/__init__.py +++ b/dvc/stage/__init__.py @@ -267,7 +267,7 @@ class Stage(params.StageParams): def _read_env(self, out, checkpoint_func=None) -> Env: env: Env = {} if out.live: - from dvc.env import DVCLIVE_PATH, DVCLIVE_REPORT, DVCLIVE_SUMMARY + from dvc.env import DVCLIVE_HTML, DVCLIVE_PATH, DVCLIVE_SUMMARY from dvc.output import BaseOutput from dvc.schema import LIVE_PROPS @@ -278,8 +278,8 @@ class Stage(params.StageParams): env[DVCLIVE_SUMMARY] = str( int(config.get(BaseOutput.PARAM_LIVE_SUMMARY, True)) ) - env[DVCLIVE_REPORT] = str( - int(config.get(BaseOutput.PARAM_LIVE_REPORT, True)) + env[DVCLIVE_HTML] = str( + int(config.get(BaseOutput.PARAM_LIVE_HTML, True)) ) elif out.checkpoint and checkpoint_func: from dvc.env import DVC_CHECKPOINT diff --git a/dvc/stage/utils.py b/dvc/stage/utils.py index 068ae888a..87a52dc39 100644 --- a/dvc/stage/utils.py +++ b/dvc/stage/utils.py @@ -81,7 +81,7 @@ def fill_stage_outputs(stage, **kwargs): def _load_live_output( - stage, live=None, live_summary=False, live_report=False, **kwargs + stage, live=None, live_summary=False, live_html=False, **kwargs ): from dvc.output import BaseOutput, loads_from @@ -93,7 +93,7 @@ def _load_live_output( use_cache=False, live={ BaseOutput.PARAM_LIVE_SUMMARY: live_summary, - BaseOutput.PARAM_LIVE_REPORT: live_report, + BaseOutput.PARAM_LIVE_HTML: live_html, }, ) @@ -364,7 +364,7 @@ def create_stage_from_cli( kwargs["cmd"] = cmd[0] if isinstance(cmd, list) and len(cmd) == 1 else cmd kwargs["live_summary"] = not kwargs.pop("live_no_summary", False) - kwargs["live_report"] = not kwargs.pop("live_no_report", False) + kwargs["live_html"] = not kwargs.pop("live_no_html", False) params = chunk_dict(parse_params(kwargs.pop("params", []))) stage = create_stage( diff --git a/tests/func/test_live.py b/tests/func/test_live.py index 5d3090aac..9e3f9e750 100644 --- a/tests/func/test_live.py +++ b/tests/func/test_live.py @@ -24,7 +24,7 @@ def live_stage(tmp_dir, scm, dvc): pytest.skip("dvclive does not exist yet") - def make(summary=True, report=True): + def make(summary=True, html=True): tmp_dir.gen("train.py", LIVE_SCRITP) tmp_dir.gen("params.yaml", "foo: 1") stage = dvc.run( @@ -34,7 +34,7 @@ def live_stage(tmp_dir, scm, dvc): name="live_stage", live="logs", live_no_summary=not summary, - live_no_report=not report, + live_no_html=not html, ) scm.add(["dvc.yaml", "dvc.lock", "train.py", "params.yaml"]) @@ -55,7 +55,7 @@ def test_export_config_tmp(tmp_dir, dvc, mocker, summary, report): name="run_logger", live="logs", live_no_summary=not summary, - live_no_report=not report, + live_no_html=not report, ) assert run_spy.call_count == 1 @@ -67,8 +67,8 @@ def test_export_config_tmp(tmp_dir, dvc, mocker, summary, report): assert "DVCLIVE_SUMMARY" in kwargs["env"] assert kwargs["env"]["DVCLIVE_SUMMARY"] == str(int(summary)) - assert "DVCLIVE_REPORT" in kwargs["env"] - assert kwargs["env"]["DVCLIVE_REPORT"] == str(int(report)) + assert "DVCLIVE_HTML" in kwargs["env"] + assert kwargs["env"]["DVCLIVE_HTML"] == str(int(report)) @pytest.mark.parametrize("summary", (True, False)) @@ -125,11 +125,11 @@ def test_experiments_track_summary(tmp_dir, scm, dvc, live_stage): assert "logs.json" in res[baseline_rev][exp_rev]["metrics"].keys() -@pytest.mark.parametrize("report", [True, False]) -def test_live_report(tmp_dir, dvc, live_stage, report): - live_stage(report=report) +@pytest.mark.parametrize("html", [True, False]) +def test_live_html(tmp_dir, dvc, live_stage, html): + live_stage(html=html) - assert (tmp_dir / "logs.html").is_file() == report + assert (tmp_dir / "logs.html").is_file() == html @pytest.fixture diff --git a/tests/unit/command/test_run.py b/tests/unit/command/test_run.py index e89c60fb1..3afbc5cbe 100644 --- a/tests/unit/command/test_run.py +++ b/tests/unit/command/test_run.py @@ -25,7 +25,7 @@ def test_run(mocker, dvc): "--live", "live", "--live-no-summary", - "--live-no-report", + "--live-no-html", "--file", "file", "--wdir", @@ -72,7 +72,7 @@ def test_run(mocker, dvc): params=["file:param1,param2", "param3"], live="live", live_no_summary=True, - live_no_report=True, + live_no_html=True, fname="file", wdir="wdir", no_exec=True, @@ -103,7 +103,7 @@ def test_run_args_from_cli(mocker, dvc): plots_no_cache=[], live=None, live_no_summary=False, - live_no_report=False, + live_no_html=False, outs_persist=[], outs_persist_no_cache=[], checkpoints=[], @@ -138,7 +138,7 @@ def test_run_args_with_spaces(mocker, dvc): plots_no_cache=[], live=None, live_no_summary=False, - live_no_report=False, + live_no_html=False, outs_persist=[], outs_persist_no_cache=[], checkpoints=[], diff --git a/tests/unit/command/test_stage.py b/tests/unit/command/test_stage.py index 9e40c13a6..6aad40e9e 100644 --- a/tests/unit/command/test_stage.py +++ b/tests/unit/command/test_stage.py @@ -36,7 +36,7 @@ def test_stage_add(mocker, dvc, command, parsed_command): "--live", "live", "--live-no-summary", - "--live-no-report", + "--live-no-html", "--wdir", "wdir", "--force", @@ -76,7 +76,7 @@ def test_stage_add(mocker, dvc, command, parsed_command): "plots_no_cache": ["plots-no-cache"], "live": "live", "live_no_summary": True, - "live_no_report": True, + "live_no_html": True, "wdir": "wdir", "outs_persist": ["outs-persist"], "outs_persist_no_cache": ["outs-persist-no-cache"],