Skip to content

Conversation

@maykulkarni
Copy link
Contributor

@maykulkarni maykulkarni commented Dec 7, 2019

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. πŸ™

If the URL is local dvc repo, the import/get should fetch from the source project cache.

Fixes treeverse#2599
@efiop efiop changed the title [WIP] fix for local file import fail [WIP] use cache dir as a default remote when importing from local repo Dec 7, 2019
@maykulkarni maykulkarni force-pushed the import-external-repo-fix branch from 2b0eef0 to 779a0a1 Compare December 8, 2019 09:15
Copy link
Contributor

@pared pared left a comment

Choose a reason for hiding this comment

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

General remark:
I think that we should not modify config of remote repo
EDIT:
@efiop had the same suggestion and it has not been resolved yet

@maykulkarni maykulkarni requested review from efiop and pared December 9, 2019 11:03
@maykulkarni maykulkarni requested review from efiop and pared December 10, 2019 06:43
Copy link
Contributor

@pared pared left a comment

Choose a reason for hiding this comment

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

Some minor things, LGTM besides that.

@maykulkarni maykulkarni requested a review from pared December 10, 2019 11:03
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.

Looks good! Just a few more minor comments.

@maykulkarni maykulkarni requested a review from efiop December 11, 2019 06:20
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.

Looks good! Thanks!

@efiop efiop changed the title [WIP] use cache dir as a default remote when importing from local repo use cache dir as a default remote when importing from local repo Dec 11, 2019
@efiop efiop merged commit 53c33a2 into treeverse:master Dec 11, 2019
@efiop
Copy link
Contributor

efiop commented Dec 11, 2019

@maykulkarni Could you also create a ticket for the docs or create a PR for docs to reflect this new logic?

Comment on lines +73 to +77
# 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):
Copy link
Contributor

Choose a reason for hiding this comment

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

@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.

Copy link
Contributor

Choose a reason for hiding this comment

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

@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.

Copy link
Contributor

@jorgeorpinel jorgeorpinel Dec 17, 2019

Choose a reason for hiding this comment

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

Sorry, I'm not sure I understand:

  1. 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?

  2. Does this PR really close import: get from source project cache if url/path are in the local systemΒ #2599 per that issue's description and discussion?

Copy link
Contributor

Choose a reason for hiding this comment

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

  1. 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.

  2. From what we've understood initially - yes, but now it looks like we didn't quite understand each other.

Copy link
Contributor

Choose a reason for hiding this comment

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

I see. OK!

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.

import: get from source project cache if url/path are in the local system

4 participants