Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1139)

Unified Diff: tools/telemetry/telemetry/util/cloud_storage.py

Issue 1008013003: Add Copy to cloud storage to allow copying from one remote path to another. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/telemetry/telemetry/util/cloud_storage_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/telemetry/telemetry/util/cloud_storage.py
diff --git a/tools/telemetry/telemetry/util/cloud_storage.py b/tools/telemetry/telemetry/util/cloud_storage.py
index 1e9fc4f9831455c249b8a9b3588d5a632b71843d..a6055e614bd2498b0523eb0217cd79da0dd30060 100644
--- a/tools/telemetry/telemetry/util/cloud_storage.py
+++ b/tools/telemetry/telemetry/util/cloud_storage.py
@@ -179,6 +179,24 @@ def Move(bucket1, bucket2, remote_path):
_RunCommand(['mv', url1, url2])
+def Copy(bucket_from, bucket_to, remote_path_from, remote_path_to):
+ """Copy a file from one location in CloudStorage to another.
+
+ Args:
+ bucket_from: The cloud storage bucket where the file is currently located.
+ bucket_to: The cloud storage bucket it is being copied to.
+ remote_path_from: The file path where the file is located in bucket_from.
+ remote_path_to: The file path it is being copied to in bucket_to.
+
+ It should: cause no changes locally or to the starting file, and will
+ overwrite any existing files in the destination location.
+ """
+ url1 = 'gs://%s/%s' % (bucket_from, remote_path_from)
+ url2 = 'gs://%s/%s' % (bucket_to, remote_path_to)
+ logging.info('Copying %s to %s' % (url1, url2))
+ _RunCommand(['cp', url1, url2])
+
+
def Delete(bucket, remote_path):
url = 'gs://%s/%s' % (bucket, remote_path)
logging.info('Deleting %s' % url)
« no previous file with comments | « no previous file | tools/telemetry/telemetry/util/cloud_storage_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698