From 9575510b98745204f99f71c4a003598d552da7bc Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Wed, 17 Nov 2021 20:29:27 +0800 Subject: [PATCH] [skip ci]Fix import and add time cost record (#12029) Signed-off-by: zhuwenxing --- tests/python_client/chaos/scripts/hello_milvus.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/python_client/chaos/scripts/hello_milvus.py b/tests/python_client/chaos/scripts/hello_milvus.py index 11b3257189..23a19996bf 100644 --- a/tests/python_client/chaos/scripts/hello_milvus.py +++ b/tests/python_client/chaos/scripts/hello_milvus.py @@ -20,6 +20,7 @@ from pymilvus import ( def hello_milvus(host="127.0.0.1"): + import time # create connection connections.connect(host=host, port="19530") @@ -66,12 +67,14 @@ def hello_milvus(host="127.0.0.1"): print(f"\nCreate index...") collection.create_index(field_name="float_vector", index_params=default_index) print(f"\nload collection...") + t0 = time.time() collection.load() + t1 = time.time() + print(f"\nload collection cost {t1 - t0} seconds") # load and search topK = 5 search_params = {"metric_type": "L2", "params": {"nprobe": 10}} - import time start_time = time.time() print(f"\nSearch...") # define output_fields of search result