2021-12-15 09:25:26 +08:00
|
|
|
from pymilvus import connections
|
2022-04-29 09:17:48 +08:00
|
|
|
import sys
|
|
|
|
sys.path.append("..")
|
|
|
|
sys.path.append("../..")
|
|
|
|
from common.milvus_sys import MilvusSys
|
2021-09-03 17:15:51 +08:00
|
|
|
from utils import *
|
|
|
|
|
|
|
|
|
2022-01-19 18:59:39 +08:00
|
|
|
def task_1(data_size, host):
|
2021-12-17 18:49:30 +08:00
|
|
|
"""
|
|
|
|
task_1:
|
2022-12-14 19:29:27 +08:00
|
|
|
before upgrade: create collection and insert data with flush, create index, load and search
|
2022-11-03 15:49:35 +08:00
|
|
|
after upgrade: get collection, load, search, insert data with flush, release, create index, load, and search
|
2021-12-17 18:49:30 +08:00
|
|
|
"""
|
|
|
|
prefix = "task_1_"
|
2022-01-19 18:59:39 +08:00
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
2022-06-24 17:14:18 +08:00
|
|
|
col_list = get_collections(prefix, check=True)
|
2023-05-30 14:25:28 +08:00
|
|
|
assert len(col_list) > 0
|
2022-10-24 17:55:30 +08:00
|
|
|
create_index(prefix)
|
2021-12-17 18:49:30 +08:00
|
|
|
load_and_search(prefix)
|
2023-04-28 14:18:35 +08:00
|
|
|
create_collections_and_insert_data(prefix, count=data_size)
|
2022-11-03 15:49:35 +08:00
|
|
|
release_collection(prefix)
|
2021-12-20 19:22:14 +08:00
|
|
|
create_index(prefix)
|
|
|
|
load_and_search(prefix)
|
2021-09-03 17:15:51 +08:00
|
|
|
|
|
|
|
|
2022-01-19 18:59:39 +08:00
|
|
|
def task_2(data_size, host):
|
2021-12-17 18:49:30 +08:00
|
|
|
"""
|
|
|
|
task_2:
|
2021-12-20 19:22:14 +08:00
|
|
|
before upgrade: create collection, insert data and create index, load and search
|
2022-11-03 15:49:35 +08:00
|
|
|
after upgrade: get collection, load, search, insert data, release, create index, load, and search
|
2021-12-17 18:49:30 +08:00
|
|
|
"""
|
|
|
|
prefix = "task_2_"
|
2022-01-19 18:59:39 +08:00
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
2022-06-24 17:14:18 +08:00
|
|
|
col_list = get_collections(prefix, check=True)
|
2023-05-30 14:25:28 +08:00
|
|
|
assert len(col_list) > 0
|
2021-12-17 18:49:30 +08:00
|
|
|
load_and_search(prefix)
|
2023-04-28 14:18:35 +08:00
|
|
|
create_collections_and_insert_data(prefix, count=data_size)
|
2022-11-03 15:49:35 +08:00
|
|
|
release_collection(prefix)
|
2021-12-17 18:49:30 +08:00
|
|
|
create_index(prefix)
|
|
|
|
load_and_search(prefix)
|
2021-09-03 17:15:51 +08:00
|
|
|
|
2021-12-17 18:49:30 +08:00
|
|
|
|
2022-04-29 09:17:48 +08:00
|
|
|
def task_3(data_size, host):
|
|
|
|
"""
|
|
|
|
task_3:
|
|
|
|
before upgrade: create collection, insert data, flush, create index, load with one replicas and search
|
2022-11-03 15:49:35 +08:00
|
|
|
after upgrade: get collection, load, search, insert data, release, create index, load with multi replicas, and search
|
2022-04-29 09:17:48 +08:00
|
|
|
"""
|
|
|
|
prefix = "task_3_"
|
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
2022-06-24 17:14:18 +08:00
|
|
|
col_list = get_collections(prefix, check=True)
|
2023-05-30 14:25:28 +08:00
|
|
|
assert len(col_list) > 0
|
2022-04-29 09:17:48 +08:00
|
|
|
load_and_search(prefix)
|
|
|
|
create_collections_and_insert_data(prefix, count=data_size)
|
2022-11-03 15:49:35 +08:00
|
|
|
release_collection(prefix)
|
2022-04-29 09:17:48 +08:00
|
|
|
create_index(prefix)
|
|
|
|
load_and_search(prefix, replicas=NUM_REPLICAS)
|
|
|
|
|
|
|
|
|
|
|
|
def task_4(data_size, host):
|
|
|
|
"""
|
|
|
|
task_4:
|
2022-10-19 10:19:26 +08:00
|
|
|
before upgrade: create collection, insert data, flush, and create index
|
|
|
|
after upgrade: get collection, load with multi replicas, search, insert data, load with multi replicas and search
|
2022-04-29 09:17:48 +08:00
|
|
|
"""
|
|
|
|
prefix = "task_4_"
|
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
2022-06-24 17:14:18 +08:00
|
|
|
col_list = get_collections(prefix, check=True)
|
2023-05-30 14:25:28 +08:00
|
|
|
assert len(col_list) > 0
|
2022-04-29 09:17:48 +08:00
|
|
|
load_and_search(prefix, replicas=NUM_REPLICAS)
|
|
|
|
create_collections_and_insert_data(prefix, flush=False, count=data_size)
|
|
|
|
load_and_search(prefix, replicas=NUM_REPLICAS)
|
|
|
|
|
|
|
|
|
|
|
|
def task_5(data_size, host):
|
|
|
|
"""
|
|
|
|
task_5_:
|
|
|
|
before upgrade: create collection and insert data without flush
|
2022-10-19 10:19:26 +08:00
|
|
|
after upgrade: get collection, create index, load with multi replicas, search, insert data with flush, load with multi replicas and search
|
2022-04-29 09:17:48 +08:00
|
|
|
"""
|
|
|
|
prefix = "task_5_"
|
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
2022-06-24 17:14:18 +08:00
|
|
|
col_list = get_collections(prefix, check=True)
|
2023-05-30 14:25:28 +08:00
|
|
|
assert len(col_list) > 0
|
2022-10-19 10:19:26 +08:00
|
|
|
create_index(prefix)
|
2022-04-29 09:17:48 +08:00
|
|
|
load_and_search(prefix, replicas=NUM_REPLICAS)
|
|
|
|
create_collections_and_insert_data(prefix, flush=True, count=data_size)
|
|
|
|
load_and_search(prefix, replicas=NUM_REPLICAS)
|
|
|
|
|
|
|
|
|
2021-12-17 18:49:30 +08:00
|
|
|
if __name__ == '__main__':
|
2021-12-25 13:44:21 +08:00
|
|
|
import argparse
|
2022-12-16 12:01:27 +08:00
|
|
|
import threading
|
2021-12-25 13:44:21 +08:00
|
|
|
parser = argparse.ArgumentParser(description='config for deploy test')
|
2022-01-19 18:59:39 +08:00
|
|
|
parser.add_argument('--host', type=str, default="127.0.0.1", help='milvus server ip')
|
2021-12-25 13:44:21 +08:00
|
|
|
parser.add_argument('--data_size', type=int, default=3000, help='data size')
|
|
|
|
args = parser.parse_args()
|
|
|
|
data_size = args.data_size
|
2022-01-19 18:59:39 +08:00
|
|
|
host = args.host
|
2022-12-16 12:01:27 +08:00
|
|
|
logger.info(f"data size: {data_size}")
|
2022-04-29 09:17:48 +08:00
|
|
|
connections.connect(host=host, port=19530, timeout=60)
|
|
|
|
ms = MilvusSys()
|
2022-11-03 15:49:35 +08:00
|
|
|
# create index for flat
|
2022-12-16 12:01:27 +08:00
|
|
|
logger.info("create index for flat start")
|
2022-11-03 15:49:35 +08:00
|
|
|
create_index_flat()
|
2022-12-16 12:01:27 +08:00
|
|
|
logger.info("create index for flat done")
|
2023-03-08 10:43:55 +08:00
|
|
|
task_1(data_size, host)
|
|
|
|
task_2(data_size, host)
|
2022-04-29 09:17:48 +08:00
|
|
|
if len(ms.query_nodes) >= NUM_REPLICAS:
|
2023-03-08 10:43:55 +08:00
|
|
|
task_3(data_size, host)
|
|
|
|
task_4(data_size, host)
|
|
|
|
task_5(data_size, host)
|
2023-03-14 10:01:54 +08:00
|
|
|
|