Skip to content

Commit

Permalink
live integration: rename report to html (iterative#5366)
Browse files Browse the repository at this point in the history
  • Loading branch information
pared authored Feb 2, 2021
1 parent 67980de commit 31e4a33
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion dvc/command/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def run(self):
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,
Expand Down
2 changes: 1 addition & 1 deletion dvc/command/stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.",
Expand Down
2 changes: 1 addition & 1 deletion dvc/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@
DVC_ROOT = "DVC_ROOT"
DVCLIVE_PATH = "DVCLIVE_PATH"
DVCLIVE_SUMMARY = "DVCLIVE_SUMMARY"
DVCLIVE_REPORT = "DVCLIVE_REPORT"
DVCLIVE_HTML = "DVCLIVE_HTML"
DVCLIVE_RESUME = "DVCLIVE_RESUME"
2 changes: 1 addition & 1 deletion dvc/output/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion dvc/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@

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}
Expand Down
6 changes: 3 additions & 3 deletions dvc/stage/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def short_description(self) -> Optional["str"]:
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

Expand All @@ -278,8 +278,8 @@ def _read_env(self, out, checkpoint_func=None) -> Env:
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
Expand Down
6 changes: 3 additions & 3 deletions dvc/stage/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,
},
)

Expand Down Expand Up @@ -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(
Expand Down
18 changes: 9 additions & 9 deletions tests/func/test_live.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -34,7 +34,7 @@ def make(summary=True, report=True):
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"])
Expand All @@ -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
Expand All @@ -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))
Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/command/test_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_run(mocker, dvc):
"--live",
"live",
"--live-no-summary",
"--live-no-report",
"--live-no-html",
"--file",
"file",
"--wdir",
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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=[],
Expand Down Expand Up @@ -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=[],
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/command/test_stage.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"],
Expand Down

0 comments on commit 31e4a33

Please sign in to comment.