Skip to content

Commit

Permalink
remote: implement Google Drive
Browse files Browse the repository at this point in the history
  • Loading branch information
ei-grad committed Jun 1, 2019
1 parent 688bcaa commit 620bb4e
Show file tree
Hide file tree
Showing 17 changed files with 1,160 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ environment:
secure: 96fJ3r2i2GohbXHwnSs5N4EplQ7q8YmLpPWM0AC+f4s=
CODECOV_TOKEN:
secure: XN4jRtmGE5Bqg8pPZkwNs7kn3UEI73Rkldqc0MGsQISZBm5TNJZOPofDMc1QnUsf
OAUTH2_TOKEN_FILE_KEY:
secure: cL2KgINnnWhfNVy+lEI/QmA31cKwYojGhFRFs1x0PAkA5QRvZxYTlBX+XpjQYF8k2A6tqYMUWztZt0dXlMKqLVf5aCtg7z2I5AWW5dhGeTY=
OAUTH2_TOKEN_FILE_IV:
secure: 6lKZF5KNCpP80lFZ7a8yFkvcwllt2eoEC7LpSS5Mlwg4ilFsjFVSm+zw2GqA7NKw
AZURE_STORAGE_CONTAINER_NAME: appveyor-tests
AZURE_STORAGE_CONNECTION_STRING: DefaultEndpointsProtocol=http;AccountName=devstoreaccount1;AccountKey=Eby8vdM02xNOcqFlqUwJPLlmEtlCDXJ1OUzFT50uSRZ6IFsuFq2UVErCz4I6tq/K1SZFPTOtr/KBHBeksoGMGw==;BlobEndpoint=http://127.0.0.1:10000/devstoreaccount1;
OSS_ENDPOINT: localhost:50004
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
include dvc/remote/gdrive/google-dvc-client-id.json
9 changes: 9 additions & 0 deletions dvc/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,9 @@ class Config(object): # pylint: disable=too-many-instance-attributes
Optional(SECTION_GCP_PROJECTNAME): str,
}

SECTION_GDRIVE_SCOPES = "gdrive_scopes"
SECTION_GDRIVE_CREDENTIALPATH = SECTION_AWS_CREDENTIALPATH

# backward compatibility
SECTION_LOCAL = "local"
SECTION_LOCAL_STORAGEPATH = SECTION_AWS_STORAGEPATH
Expand Down Expand Up @@ -250,6 +253,7 @@ class Config(object): # pylint: disable=too-many-instance-attributes
Optional(SECTION_AWS_LIST_OBJECTS, default=False): BOOL_SCHEMA,
Optional(SECTION_AWS_USE_SSL, default=True): BOOL_SCHEMA,
Optional(SECTION_GCP_PROJECTNAME): str,
Optional(SECTION_GDRIVE_SCOPES): str,
Optional(SECTION_CACHE_TYPE): SECTION_CACHE_TYPE_SCHEMA,
Optional(SECTION_CACHE_PROTECTED, default=False): BOOL_SCHEMA,
Optional(SECTION_REMOTE_USER): str,
Expand All @@ -273,11 +277,16 @@ class Config(object): # pylint: disable=too-many-instance-attributes
Optional(SECTION_STATE_ROW_CLEANUP_QUOTA): And(Use(int), is_percent),
}

SECTION_OAUTH2 = "oauth2"
SECTION_OAUTH2_FLOW_RUNNER = "flow_runner"
SECTION_OAUTH2_SCHEMA = {Optional(SECTION_OAUTH2_FLOW_RUNNER): str}

SCHEMA = {
Optional(SECTION_CORE, default={}): SECTION_CORE_SCHEMA,
Optional(Regex(SECTION_REMOTE_REGEX)): SECTION_REMOTE_SCHEMA,
Optional(SECTION_CACHE, default={}): SECTION_CACHE_SCHEMA,
Optional(SECTION_STATE, default={}): SECTION_STATE_SCHEMA,
Optional(SECTION_OAUTH2, default={}): SECTION_OAUTH2_SCHEMA,
# backward compatibility
Optional(SECTION_AWS, default={}): SECTION_AWS_SCHEMA,
Optional(SECTION_GCP, default={}): SECTION_GCP_SCHEMA,
Expand Down
2 changes: 2 additions & 0 deletions dvc/data_cloud.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
from dvc.remote import Remote
from dvc.remote.s3 import RemoteS3
from dvc.remote.gs import RemoteGS
from dvc.remote.gdrive import RemoteGDrive
from dvc.remote.azure import RemoteAZURE
from dvc.remote.oss import RemoteOSS
from dvc.remote.ssh import RemoteSSH
Expand All @@ -34,6 +35,7 @@ class DataCloud(object):
CLOUD_MAP = {
"aws": RemoteS3,
"gcp": RemoteGS,
"gdrive": RemoteGDrive,
"azure": RemoteAZURE,
"oss": RemoteOSS,
"ssh": RemoteSSH,
Expand Down
10 changes: 10 additions & 0 deletions dvc/path/gdrive.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
from dvc.scheme import Schemes
from .base import PathBASE


class PathGDrive(PathBASE):
scheme = Schemes.GDRIVE

def __init__(self, root, url=None, path=None):
super(PathGDrive, self).__init__(url, path)
self.root = root
10 changes: 6 additions & 4 deletions dvc/remote/__init__.py
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
from __future__ import unicode_literals

from dvc.remote.azure import RemoteAZURE
from dvc.remote.gdrive import RemoteGDrive
from dvc.remote.gs import RemoteGS
from dvc.remote.hdfs import RemoteHDFS
from dvc.remote.local import RemoteLOCAL
from dvc.remote.s3 import RemoteS3
from dvc.remote.ssh import RemoteSSH
from dvc.remote.http import RemoteHTTP
from dvc.remote.https import RemoteHTTPS
from dvc.remote.local import RemoteLOCAL
from dvc.remote.oss import RemoteOSS
from dvc.remote.s3 import RemoteS3
from dvc.remote.ssh import RemoteSSH


REMOTES = [
RemoteAZURE,
RemoteGDrive,
RemoteGS,
RemoteHDFS,
RemoteHTTP,
RemoteHTTPS,
RemoteOSS,
RemoteS3,
RemoteSSH,
RemoteOSS,
# NOTE: RemoteLOCAL is the default
]

Expand Down
2 changes: 1 addition & 1 deletion dvc/remote/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ def download(
from_infos,
to_infos,
no_progress_bar=False,
name=None,
names=None,
resume=False,
):
raise RemoteActionNotImplemented("download", self.scheme)
Expand Down
Loading

0 comments on commit 620bb4e

Please sign in to comment.