Skip to content

Conversation

@pared
Copy link
Contributor

@pared pared commented Apr 26, 2019

  • Have you followed the guidelines in our
    Contributing document?

  • Does your PR affect documented changes or does it add new functionality
    that should be documented? If yes, have you created a PR for
    dvc.org documenting it or at
    least opened an issue for it? If so, please add a link to it.


Fixes #1917

@pared pared requested a review from efiop April 26, 2019 04:49
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't match ENOENT error, which means that there is no such file and your "COULD NOT READ" might be interpreted as formatting issue. Formatting problems are captured in the _read_metric itself.

Also, take a look at _read_metrics_filesystem, which simply returns None if metric doesn't exist. It is crutial that they both behave the same. Should we ignore it here as well?

Copy link
Contributor Author

@pared pared Apr 26, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that returning None is ok, but I think that it would be good to somehow pass information that file could not be opened. None as value can be interpreted in many ways. Though, in such case we should probably inform user upon _read_metrics_filesystem too.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you are using "COULD NOT READ" as a metric, then you better use

self.dvc.metrics.show()

which will return a dict that you could easily check without messing around with logs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In updated version we warn user about lack of metric file, now caplog is required

@pared
Copy link
Contributor Author

pared commented Apr 26, 2019

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe let's move it into a separate function?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

path is the cache file, so it should be Cache file '{}...`.

Copy link
Contributor

@efiop efiop Apr 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or maybe you could generalize this and what you've done down below?

@pared pared requested a review from efiop April 29, 2019 18:04
@pared pared force-pushed the 1917 branch 3 times, most recently from 950ef6e to eecfae5 Compare April 29, 2019 19:31
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just __init__ ?

Copy link
Contributor Author

@pared pared Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pytest by default does not collect classes that have __init__()
https://docs.pytest.org/en/latest/goodpractices.html#conventions-for-python-test-discovery

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't know that, thanks for clarifying! 🙂

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But in this case Metrics file '{}' does not exist at branch: '{}' doesn't really fit, since path is a cache file for metric file 🙂

Copy link
Contributor Author

@pared pared Apr 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not exactly, we pass out.relpath to warning message, which is "common part" for both use cases. We always get relative path of our out.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, right. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, it is a reoccurring issue within this whole file, but it is not always a branch that we are getting, it could be a tag as well. Should we generalize it and call it reference or something? Would that make sense?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is not really related to your patch, but I've just noticed it and had to mention 🙂

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, ill do that.

@efiop efiop merged commit 3265a25 into treeverse:master Apr 29, 2019
@pared pared deleted the 1917 branch November 12, 2019 08:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"dvc metrics show -a" doesn't work if a metric file is missing

2 participants