mirror of
https://github.com/Stone-Red-Code/dvc.git
synced 2026-11-10 07:18:27 +01:00
E.g.: dvc run -d gs://bucket/file -o file gsutil cp gs://bucket/file file dvc run -d s3://bucket/file -o file aws s3 cp s3://bucket/file file Etags are used to track deps in both cases. Signed-off-by: Ruslan Kuprieiev <[email protected]>
24 lines
543 B
Python
24 lines
543 B
Python
from google.cloud import storage as gc
|
|
|
|
try:
|
|
from urlparse import urlparse
|
|
except ImportError:
|
|
from urllib.parse import urlparse
|
|
|
|
from dvc.dependency.s3 import DependencyS3
|
|
from dvc.cloud.gcp import DataCloudGCP
|
|
|
|
|
|
class DependencyGS(DependencyS3):
|
|
REGEX = DataCloudGCP.REGEX
|
|
|
|
def get_etag(self):
|
|
o = urlparse(self.path)
|
|
bucket_name = o.netloc
|
|
key = o.path.lstrip('/')
|
|
|
|
client = gc.Client()
|
|
bucket = client.bucket(bucket_name)
|
|
blob = bucket.get_blob(key)
|
|
return blob.etag
|