From 0da1b04c4c03569b4fca81d41adbedd3ceb69983 Mon Sep 17 00:00:00 2001 From: zhuwenxing Date: Thu, 30 Dec 2021 21:17:22 +0800 Subject: [PATCH] [skip e2e]Unified time output format (#14638) Signed-off-by: zhuwenxing --- .../python_client/chaos/scripts/hello_milvus.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/python_client/chaos/scripts/hello_milvus.py b/tests/python_client/chaos/scripts/hello_milvus.py index 90fab976a7..6db8c25272 100644 --- a/tests/python_client/chaos/scripts/hello_milvus.py +++ b/tests/python_client/chaos/scripts/hello_milvus.py @@ -54,13 +54,13 @@ def hello_milvus(host="127.0.0.1"): ] ) t1 = time.time() - print(f"\nInsert {nb} vectors cost {t1 - t0} seconds") + print(f"\nInsert {nb} vectors cost {t1 - t0:.4f} seconds") t0 = time.time() print(f"\nGet collection entities...") print(collection.num_entities) t1 = time.time() - print(f"\nGet collection entities cost {t1 - t0} seconds") + print(f"\nGet collection entities cost {t1 - t0:.4f} seconds") # create index and load table default_index = {"index_type": "IVF_FLAT", "params": {"nlist": 128}, "metric_type": "L2"} @@ -68,31 +68,31 @@ def hello_milvus(host="127.0.0.1"): t0 = time.time() collection.create_index(field_name="float_vector", index_params=default_index) t1 = time.time() - print(f"\nCreate index cost {t1 - t0} seconds") + print(f"\nCreate index cost {t1 - t0:.4f} seconds") print(f"\nload collection...") t0 = time.time() collection.load() t1 = time.time() - print(f"\nload collection cost {t1 - t0} seconds") + print(f"\nload collection cost {t1 - t0:.4f} seconds") # load and search topK = 5 search_params = {"metric_type": "L2", "params": {"nprobe": 10}} - start_time = time.time() + t0 = time.time() print(f"\nSearch...") # define output_fields of search result res = collection.search( vectors[-2:], "float_vector", search_params, topK, "count > 100", output_fields=["count", "random_value"], timeout=TIMEOUT ) - end_time = time.time() - + t1 = time.time() + print(f"search cost {t1 - t0:.4f} seconds") # show result for hits in res: for hit in hits: # Get value of the random value field for search result print(hit, hit.entity.get("random_value")) - print("search latency = %.4fs" % (end_time - start_time)) + # query expr = "count in [2,4,6,8]"