Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

metrics: accept any viable target in DvcRepo #4590

Merged
merged 1 commit into from
Sep 22, 2020

Conversation

pared
Copy link
Contributor

@pared pared commented Sep 22, 2020

Thank you for the contribution - we'll try to review it as soon as possible. πŸ™

@pared
Copy link
Contributor Author

pared commented Sep 22, 2020

@jorgeorpinel Do you think its worth mentioning in docs that from this change on dvc metrics will work with any file if its provided via targets?

dvc/repo/metrics/show.py Outdated Show resolved Hide resolved
dvc/repo/metrics/show.py Outdated Show resolved Hide resolved
dvc/repo/metrics/show.py Outdated Show resolved Hide resolved
dvc/repo/metrics/show.py Outdated Show resolved Hide resolved
target_infos = [PathInfo(os.path.abspath(target)) for target in targets]
if recursive:
Copy link
Contributor

Choose a reason for hiding this comment

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

Will recursive work with unofficial metrics? I don't see a test for it and the code seems like it won't work.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not sure how that would work, I mean, in that case we would need to try to show all files for particular directory, since they are not marked as metrics. So the question here is whether we want to support that.

Copy link
Contributor

Choose a reason for hiding this comment

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

@pared That seems like a natural approach. You have a test with official metrics dir in this PR, what changes if they are not declared as official metrics?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

On the other hand, it kinda makes sense to have special dir for metrics and check all of them out. Ill try to modify the change.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also note that we try to parse metric files, so if something is not a metric we'll just ignore it and won't show it.


tree = RepoTree(repo)
for target_info in target_infos:
if tree.isfile(target_info):
Copy link
Contributor

Choose a reason for hiding this comment

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

What if a target is a file and recursive==True? Will it be added to the result twice?

Copy link
Contributor

Choose a reason for hiding this comment

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

This will probably become obsoleted once you implement recursive for unofficial metrics above...

@pared pared force-pushed the 4446_metrics branch 2 times, most recently from 11d1259 to 5978287 Compare September 22, 2020 16:56
@pared pared requested a review from efiop September 22, 2020 16:56
"branch": {"metrics.yaml": {"foo": 2.2}},
}


Copy link
Contributor

Choose a reason for hiding this comment

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

Missing a test for recursive directory with unofficial metrics.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Since both official and unofficial metrics are gathered the same way now, I would argue that test_non_metric_and_recurisve_show already covers that. Anyhow, I modified it so that it checks both official and unofficial metrics.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! πŸ™

Copy link
Contributor

@efiop efiop left a comment

Choose a reason for hiding this comment

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

Thanks!

@efiop efiop merged commit 2b3c30c into iterative:master Sep 22, 2020
@pared pared added the enhancement Enhances DVC label Sep 23, 2020
@jorgeorpinel
Copy link
Contributor

Do you think its worth mentioning in docs

Yes! Very much πŸ™‚ β€” thanks for submitting a docs PR BTW.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhances DVC
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants