mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-02 07:18:25 +01:00
* 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]>
40 lines
831 B
Python
40 lines
831 B
Python
import csv
|
|
import os
|
|
from contextlib import contextmanager
|
|
|
|
from funcy import first
|
|
|
|
from dvc.scm import Git
|
|
|
|
|
|
def get_gitignore_content():
|
|
with open(Git.GITIGNORE) as gitignore:
|
|
return gitignore.read().splitlines()
|
|
|
|
|
|
@contextmanager
|
|
def cd(newdir):
|
|
prevdir = os.getcwd()
|
|
os.chdir(os.path.expanduser(newdir))
|
|
try:
|
|
yield
|
|
finally:
|
|
os.chdir(prevdir)
|
|
|
|
|
|
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()))
|