-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Conversation
@jorgeorpinel Do you think its worth mentioning in docs that from this change on |
dvc/repo/metrics/show.py
Outdated
target_infos = [PathInfo(os.path.abspath(target)) for target in targets] | ||
if recursive: |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
dvc/repo/metrics/show.py
Outdated
|
||
tree = RepoTree(repo) | ||
for target_info in target_infos: | ||
if tree.isfile(target_info): |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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...
11d1259
to
5978287
Compare
"branch": {"metrics.yaml": {"foo": 2.2}}, | ||
} | ||
|
||
|
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! π
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Yes! Very much π β thanks for submitting a docs PR BTW. |
β I have followed the Contributing to DVC checklist.
π If this PR requires documentation updates, I have created a separate PR (or issue, at least) in dvc.org and linked it here.
Thank you for the contribution - we'll try to review it as soon as possible. π