use cache dir as a default remote when importing from local repo#2915
Conversation
If the URL is local dvc repo, the import/get should fetch from the source project cache. Fixes treeverse#2599
2b0eef0 to
779a0a1
Compare
If the URL is local dvc repo, the import/get should fetch from the source project cache. Fixes treeverse#2599
pared
left a comment
There was a problem hiding this comment.
Some minor things, LGTM besides that.
efiop
left a comment
There was a problem hiding this comment.
Looks good! Just a few more minor comments.
|
@maykulkarni Could you also create a ticket for the docs or create a PR for docs to reflect this new logic? |
| # check if the URL is local and no default remote is present | ||
| # add default remote pointing to the original repo's cache location | ||
| if os.path.isdir(url): | ||
| rconfig = RemoteConfig(repo.config) | ||
| if not _default_remote_set(rconfig): |
There was a problem hiding this comment.
@maykulkarni @efiop does this logic mean that if there's a default remote setup, still DVC skips the local cache? Because I think it should try the local cache first regardless of remotes.
There was a problem hiding this comment.
@jorgeorpinel Yes, precisely. It is hard for us to try both right now, as we don't have that kind of cascading remote logic implemented. I would wait for someone to ask for this.
There was a problem hiding this comment.
Sorry, I'm not sure I understand:
-
Every DVC repo has a cache directory right? So in theory it can always be the first place to get stuff from when using get/import from another local project. Why does this require complicated remote checking logic?
-
Does this PR really close
import: get from source project cache ifurl/pathare in the local system #2599 per that issue's description and discussion?
There was a problem hiding this comment.
-
Yes, but "first place to get stuff from" means that there is a second place, and our code is not ready to cascade from first to second yet, if it can't find all the stuff it needs in the local cache dir.
-
From what we've understood initially - yes, but now it looks like we didn't quite understand each other.
If the URL is local dvc repo, the import/get should fetch from the source project cache.
Fixes #2599
❗ Have you followed the guidelines in the Contributing to DVC list?
📖 Check this box if this PR does not require documentation updates, or if it does and you have created a separate PR in dvc.org with such updates (or at least opened an issue about it in that repo). Please link below to your PR (or issue) in the dvc.org repo.
❌ Have you checked DeepSource, CodeClimate, and other sanity checks below? We consider their findings recommendatory and don't expect everything to be addressed. Please review them carefully and fix those that actually improve code or fix bugs.
Thank you for the contribution - we'll try to review it as soon as possible. 🙏