Skip to content

metrics remove doesn't work for pipeline files #3907

Closed
@Suor

Description

@Suor

The dvc metrics remove command doesn't work if targeted metric resides within pipeline file. The underlying issue is that Dvcfile.dump() might dump a file or not depending on particular class.

Looks like the culprit is that PipelineFile.dump() tries to serve two purposes, i.e. dump both pipeline file and corresponding lock file, additionally PipelineFile.dump() has unsafe default, i.e. not really saving a pipeline file unless extra flag is passed. I would split repsponsibilities:

  1. Make PipelineFile.dump() dump pipeline file as its name suggest.
  2. Add PipelineFile.dump_lock() and call that when you need to dump a lock file.

NOTE: I found this bug by spotting the unsafe default in .dump() and looking through its uses. There might be more related bugs.

Output of dvc version:

$ dvc version
DVC version: 1.0.0a6+bb50fb
Python version: 3.8.2
Platform: Linux-5.4.0-31-generic-x86_64-with-glibc2.27
Binary: False
Package: None
Supported remotes: http, https
Cache: reflink - not supported, hardlink - supported, symlink - supported
Repo: dvc, git

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugDid we break something?

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions