Skip to content

Commit

Permalink
fix(gcs): return file url from upload_file_*
Browse files Browse the repository at this point in the history
Signed-off-by: Cameron Smith <[email protected]>
  • Loading branch information
cameronraysmith committed Mar 16, 2024
1 parent 66951f1 commit 7d5698e
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/pyrovelocity/io/gcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def upload_file_concurrently(
destination_blob_name: str,
chunk_size: int = 32 * 1024 * 1024,
workers: int = 8,
) -> Result[None, Exception]:
) -> Result[str, Exception]:
"""
Upload a single file, in chunks, concurrently in a process pool.
Expand All @@ -106,10 +106,9 @@ def upload_file_concurrently(
source_filename, blob, chunk_size=chunk_size, max_workers=workers
)

logger.info(
f"File {source_filename} uploaded to {destination_blob_name}."
)
return Success(None)
file_url = f"https://storage.googleapis.com/{bucket_name}/{destination_blob_name}"
logger.info(f"File {source_filename} uploaded to:\n{file_url}")
return Success(file_url)
except Exception as e:
logger.error(
f"Failed to upload file {source_filename} due to exception: {e}"
Expand Down

0 comments on commit 7d5698e

Please sign in to comment.