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

remote: separate tree functions from main remote classes #3931

Merged
merged 12 commits into from
Jun 3, 2020

Conversation

pmrowla
Copy link
Contributor

@pmrowla pmrowla commented Jun 2, 2020

  • ❗ 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. If the CLI API is changed, I have updated tab completion scripts.

  • ❌ I will check DeepSource, CodeClimate, and other sanity checks below. (We consider them recommendatory and don't expect everything to be addressed. Please fix things that actually improve code or fix bugs.)

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

This PR does not change any existing behavior, it only moves an initial set of functions from Remote into RemoteTree classes (which can be accessed via remote.tree). The next set of functions to be moved for this refactor (separating remote and cache behavior) will also need to accept explicit tree parameters, so we need some minimal RemoteTree functionality before that.

upload() and download() will be moved into the trees in a future PR.

Related to #3882.

@pmrowla pmrowla self-assigned this Jun 2, 2020
@pmrowla pmrowla force-pushed the remote-tree-initial branch from ebb1e61 to 71f4540 Compare June 2, 2020 07:25
@pmrowla pmrowla marked this pull request as ready for review June 2, 2020 11:38
@pmrowla pmrowla changed the title [WIP] remote: separate tree functions from main remote classes remote: separate tree functions from main remote classes Jun 2, 2020
@pmrowla pmrowla requested a review from efiop June 2, 2020 11:39
@@ -65,14 +99,7 @@ def get_etag(self, path_info):
def get_file_checksum(self, path_info):
return self.get_etag(path_info)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should etag be part of the tree too? Kinda like stat.

self.blob_service.delete_blob(path_info.bucket, path_info.path)

def _list_paths(self, bucket, prefix, progress_callback=None):
def list_paths(self, bucket, prefix, progress_callback=None):
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't this walk_files ? πŸ™‚

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It probably should be. I think it makes sense to implement walk_files for the remotes which still do not have it as a part of this overall refactoring, but in this PR I was only looking to start moving functions into the tree classes without changing existing behavior and potentially breaking things.

class GSRemoteTree(BaseRemoteTree):
@property
def gs(self):
return self.remote.gs
Copy link
Contributor

Choose a reason for hiding this comment

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

This is kinda strange. Shouldn't the connection be part of the Tree?

Copy link
Contributor

Choose a reason for hiding this comment

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

Or is it just a convenience that will be fixed after the transition?

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 think all of the connection/config related code for all of the remotes needs to be moved into the trees. This (and the equivalent properties in the other remotes) is just a temporary fix since I was trying to avoid moving everything all at once

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.

Great start! Excited for the upcoming patches!

@efiop efiop merged commit 2c0116c into iterative:master Jun 3, 2020
@pmrowla pmrowla deleted the remote-tree-initial branch June 3, 2020 03:05
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.

2 participants