Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions qdrant_client/uploader/grpc_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,22 @@ def start(

def process_upload(self, items: Iterable[Any]) -> Generator[bool, None, None]:
channel = get_channel(host=self._host, port=self._port, **self._kwargs)
points_client = grpc.PointsStub(channel)
for batch in items:
yield upload_batch_grpc(
points_client,
self.collection_name,
batch,
shard_key_selector=self._shard_key_selector,
update_filter=self._update_filter,
update_mode=self._update_mode,
max_retries=self.max_retries,
wait=self._wait,
timeout=self._timeout,
)
try:
points_client = grpc.PointsStub(channel)
for batch in items:
yield upload_batch_grpc(
points_client,
self.collection_name,
batch,
shard_key_selector=self._shard_key_selector,
update_filter=self._update_filter,
update_mode=self._update_mode,
max_retries=self.max_retries,
wait=self._wait,
timeout=self._timeout,
)
finally:
channel.close()

def process(self, items: Iterable[Any]) -> Iterable[bool]:
yield from self.process_upload(items)
25 changes: 14 additions & 11 deletions qdrant_client/uploader/rest_uploader.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,14 +112,17 @@ def start(
return cls(uri=uri, collection_name=collection_name, max_retries=max_retries, **kwargs)

def process(self, items: Iterable[Any]) -> Iterable[bool]:
for batch in items:
yield upload_batch(
self.openapi_client,
self.collection_name,
batch,
shard_key_selector=self._shard_key_selector,
max_retries=self.max_retries,
update_filter=self._update_filter,
update_mode=self._update_mode,
wait=self._wait,
)
try:
for batch in items:
yield upload_batch(
self.openapi_client,
self.collection_name,
batch,
shard_key_selector=self._shard_key_selector,
max_retries=self.max_retries,
update_filter=self._update_filter,
update_mode=self._update_mode,
wait=self._wait,
)
finally:
self.openapi_client.close()