コード例 #1
0
def DownloadFromCloudStorage(filepath):
  """Get the given file from cloud storage."""
  try:
    gsutil.Copy(
        posixpath.join(CLOUD_STORAGE_DIR, os.path.basename(filepath)), filepath)
    logging.info('Downloaded copy of %s from cloud storage.', filepath)
    return True
  except subprocess.CalledProcessError:
    logging.info('Failed to download copy of %s from cloud storage.', filepath)
    return False
コード例 #2
0
def UploadToCloudStorage(filepath):
    """Copy the given file to cloud storage."""
    gsutil.Copy(filepath,
                posixpath.join(CLOUD_STORAGE_DIR, os.path.basename(filepath)))