Skip to content

Commit

Permalink
More progress
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelzubarev committed Oct 25, 2023
1 parent 8edc408 commit c1b184a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion cognite/cdffs/memory_upload_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ def __init__(self, metadata: FileMetadata, cognite_client: CogniteClient):
super().__init__(metadata, cognite_client)
self.blocks: Dict[int, bytes] = {}
self.lock = threading.Lock()
self.metadata = metadata

def upload_chunk(self, data: bytes, index: int) -> None:
"""Upload single chunk."""
Expand All @@ -27,7 +28,7 @@ def merge_chunks(self) -> None:
"""Merge all uploaded blocks into the final blob."""
try:
content = b"".join([self.blocks[key] for key in sorted(self.blocks.keys())])
self.cognite_client.files.upload_bytes(content=content, id=self.params["id"])
self.cognite_client.files.upload_bytes(content=content, **self.metadata.dump())
except Exception as ex:
logging.warning("Failed to merge all blocks: {ex}", exc_info=ex)
raise

0 comments on commit c1b184a

Please sign in to comment.