Skip to content

Commit 3da1040

Browse files
authored
[Enhancement] allows to specufy temp local path for RemoteBulkWriter for temporarily persisting data files (#3077)
issue: #3015 Signed-off-by: yhmo <yihua.mo@zilliz.com>
1 parent ddbf5f9 commit 3da1040

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

examples/bulk_import/bulk_writer_all_types.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ def remote_writer(schema: CollectionSchema, file_type: BulkFileType):
216216
with RemoteBulkWriter(
217217
schema=schema,
218218
remote_path="bulk_data",
219+
local_path="/tmp/PARQUET",
219220
connect_param=RemoteBulkWriter.S3ConnectParam(
220221
endpoint=MINIO_ADDRESS,
221222
access_key=MINIO_ACCESS_KEY,

pymilvus/bulk_writer/remote_bulk_writer.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@
3232

3333
logger = logging.getLogger(__name__)
3434

35+
TEMP_LOCAL_PATH = "local_path"
36+
3537

3638
class RemoteBulkWriter(LocalBulkWriter):
3739
class S3ConnectParam:
@@ -112,8 +114,12 @@ def __init__(
112114
config: Optional[dict] = None,
113115
**kwargs,
114116
):
115-
local_path = Path(sys.argv[0]).resolve().parent.joinpath("bulk_writer")
116-
super().__init__(schema, str(local_path), chunk_size, file_type, config, **kwargs)
117+
temp_local_path = str(Path(sys.argv[0]).resolve().parent.joinpath("bulk_writer"))
118+
if TEMP_LOCAL_PATH in kwargs:
119+
temp_local_path = kwargs.get(TEMP_LOCAL_PATH)
120+
kwargs.pop(TEMP_LOCAL_PATH)
121+
super().__init__(schema, temp_local_path, chunk_size, file_type, config, **kwargs)
122+
117123
self._remote_path = Path("/").joinpath(remote_path).joinpath(super().uuid)
118124
self._connect_param = connect_param
119125
self._client = None

0 commit comments

Comments
 (0)