Skip to content

Commit

Permalink
Gzip zenodo export
Browse files Browse the repository at this point in the history
  • Loading branch information
webb-ben committed Mar 4, 2025
1 parent 662659e commit aa814b5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion userCode/exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def nquads_to_zenodo(

# Use the deposit ID to upload the file
response = requests.put(
deposit["links"]["bucket"] + "/geoconnex-graph.nq",
deposit["links"]["bucket"] + "/geoconnex-graph.nq.gz",
data=stream,
headers={"Authorization": f"Bearer {TOKEN}"},
)
Expand Down
6 changes: 4 additions & 2 deletions userCode/lib/classes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,15 @@ def read(self, remote_path: str) -> bytes:
response.release_conn()
return data

def read_stream(self, remote_path: str):
def read_stream(self, remote_path: str, decode_content: bool = False):
"""Read an object from S3 as a stream"""
response: BaseHTTPResponse = self.client.get_object(
GLEANER_MINIO_BUCKET, remote_path
)
try:
for chunk in response.stream(8 * 1024 * 1024, decode_content=True):
for chunk in response.stream(
8 * 1024 * 1024, decode_content=decode_content
):
yield chunk
finally:
response.close()
Expand Down

0 comments on commit aa814b5

Please sign in to comment.