未验证 提交 32c70b7f 编写于 作者: Z zhuwenxing 提交者: GitHub

[skip e2e]Get the number of replicas needed to load via get_replicas (#17872)

Signed-off-by: Nzhuwenxing <wenxing.zhu@zilliz.com>
上级 617e029d
......@@ -74,9 +74,17 @@ def hello_milvus(host="127.0.0.1"):
collection.create_index(field_name="float_vector", index_params=default_index)
t1 = time.time()
print(f"\nCreate index cost {t1 - t0:.4f} seconds")
print("\nGet replicas number")
try:
replicas_info = collection.get_replicas()
replica_number = len(replicas_info.groups)
print(f"\nReplicas number is {replica_number}")
except Exception as e:
print(str(e))
replica_number = 1
print(f"\nload collection...")
t0 = time.time()
collection.load()
collection.load(replica_number=replica_number)
t1 = time.time()
print(f"\nload collection cost {t1 - t0:.4f} seconds")
......@@ -105,7 +113,6 @@ def hello_milvus(host="127.0.0.1"):
sorted_res = sorted(res, key=lambda k: k['int64'])
for r in sorted_res:
print(r)
# collection.release()
parser = argparse.ArgumentParser(description='host ip')
......
......@@ -69,9 +69,17 @@ def hello_milvus(collection_name):
collection.create_index(field_name="float_vector", index_params=default_index)
t1 = time.time()
print(f"\nCreate index cost {t1 - t0:.4f} seconds")
print("\nGet replicas number")
try:
replicas_info = collection.get_replicas()
replica_number = len(replicas_info.groups)
print(f"\nReplicas number is {replica_number}")
except Exception as e:
print(str(e))
replica_number = 1
print(f"\nload collection...")
t0 = time.time()
collection.load()
collection.load(replica_number=replica_number)
t1 = time.time()
print(f"\nload collection cost {t1 - t0:.4f} seconds")
......@@ -100,11 +108,10 @@ def hello_milvus(collection_name):
sorted_res = sorted(res, key=lambda k: k['int64'])
for r in sorted_res:
print(r)
collection.release()
parser = argparse.ArgumentParser(description='host ip')
parser.add_argument('--host', type=str, default='10.96.77.209', help='host ip')
parser.add_argument('--host', type=str, default='127.0.0.1', help='host ip')
args = parser.parse_args()
# add time stamp
print(f"\nStart time: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}")
......
......@@ -86,7 +86,7 @@ class TestChaos(TestChaosBase):
@pytest.fixture(scope="function", autouse=True)
def init_health_checkers(self):
c_name = cf.gen_unique_str('Checker_')
c_name = cf.gen_unique_str('MultiReplicasChecker_')
replicas_num = 2
shards_num = 2
checkers = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册