Skip to content

Commit

Permalink
Url check for bulk_import
Browse files Browse the repository at this point in the history
Signed-off-by: yhmo <[email protected]>
  • Loading branch information
yhmo committed Sep 15, 2023
1 parent 1ae931f commit 9b9844b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion examples/example_bulkwriter.py
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,6 @@ def test_cloud_bulkinsert():
test_call_bulkinsert(schema, batch_files)
test_retrieve_imported_data(bin_vec=True)

# to test cloud bulkinsert api, you need to apply a cloud service from Zilliz Cloud(https://zilliz.com/cloud)
# # to test cloud bulkinsert api, you need to apply a cloud service from Zilliz Cloud(https://zilliz.com/cloud)
# test_cloud_bulkinsert()

22 changes: 19 additions & 3 deletions pymilvus/bulk_writer/bulk_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import json
import logging
from urllib.parse import urlparse

import requests

Expand Down Expand Up @@ -98,7 +99,12 @@ def bulk_import(
Returns:
json: response of the restful interface
"""
request_url = f"https://{url}/v1/vector/collections/import"
up = urlparse(url)
if up.scheme.startswith("http"):
request_url = f"{url}/v1/vector/collections/import"
else:
request_url = f"https://{url}/v1/vector/collections/import"

params = {
"objectUrl": object_url,
"accessKey": access_key,
Expand All @@ -125,7 +131,12 @@ def get_import_progress(
Returns:
json: response of the restful interface
"""
request_url = f"https://{url}/v1/vector/collections/import/get"
up = urlparse(url)
if up.scheme.startswith("http"):
request_url = f"{url}/v1/vector/collections/import/get"
else:
request_url = f"https://{url}/v1/vector/collections/import/get"

params = {
"jobId": job_id,
"clusterId": cluster_id,
Expand All @@ -150,7 +161,12 @@ def list_import_jobs(
Returns:
json: response of the restful interface
"""
request_url = f"https://{url}/v1/vector/collections/import/list"
up = urlparse(url)
if up.scheme.startswith("http"):
request_url = f"{url}/v1/vector/collections/import/list"
else:
request_url = f"https://{url}/v1/vector/collections/import/list"

params = {
"clusterId": cluster_id,
"pageSize": page_size,
Expand Down

0 comments on commit 9b9844b

Please sign in to comment.