live logs initial (#4902)

* plots: allow dir plots

* first scenario

* separate dvclive tests

* rename index to step

* another test

* refactor

* its ok to have step in data

* sort plots

* introduce --logs

* add logs to run commands

* variable name refactoring

* fix logs option

* fixup

* cmd: run: fix unit tests

* plots: modify: fix tests

* improve dir handling

* fixup

* dvclive: logs summary

* api: introduce logs summarization method

* handle no repo case

* fix granular dir plots

* api: dvclive: simplify

* dvclive: roll back logs flag

* cmd: introduce logs

* api: adjust to logs

* test: dvclive fix

* rename logs to dvclive

* live: command: add uninitialized

* outs: dvclive type

* dvclive: support providing config via evn variables

* dvclive: treat as metrics

* dvclive integration: add support for summary on/off

* dvc integration: add temporary test for configuration export

* remove requirements

* cmd: introduce logs

* rename logs to dvclive

* cmd: introduce logs

* remove logs leftowvers

* dvclive: env: adjust to chekpoints env variables

* command: live: remove unnecessary help

* fix linter suggestions

* type hinting

* review refactor

* replace dvclive with live

* stage: loading: move live loading to separate method

* stage: serialize: allow only single live output

* live: add show/diff

* stage: serialize: roll back single live enforcing

* fixup

* rebase fixups

* output: live: force single instance

* live: command: add unit tests

* Update dvc/output/base.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>

* Update dvc/stage/__init__.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>

* Update dvc/stage/serialize.py

Co-authored-by: Ruslan Kuprieiev <[email protected]>

* review v2

* live: fix summary tracking by experiments

* naming fixups

* api: live: add tests

* tests: api: separate live tests

Co-authored-by: Ruslan Kuprieiev <[email protected]>
This commit is contained in:
Paweł Redzyński
2021-01-04 11:29:41 +02:00
committed by GitHub
co-authored by Ruslan Kuprieiev
parent 19606ba211
commit 862ab8de62
36 changed files with 810 additions and 89 deletions
+16
View File
@@ -1,6 +1,9 @@
import csv
import os
from contextlib import contextmanager
from funcy import first
from dvc.scm import Git
@@ -21,3 +24,16 @@ def cd(newdir):
def to_posixpath(path):
return path.replace("\\", "/")
def dump_sv(stream, metrics, delimiter=",", header=True):
if header:
writer = csv.DictWriter(
stream, fieldnames=list(first(metrics).keys()), delimiter=delimiter
)
writer.writeheader()
writer.writerows(metrics)
else:
writer = csv.writer(stream)
for d in metrics:
writer.writerow(list(d.values()))