mirror of
https://gitee.com/milvus-io/milvus.git
synced 2025-12-08 01:58:34 +08:00
[skip e2e]Get the number of replicas needed to load via get_replicas (#17872)
Signed-off-by: zhuwenxing <wenxing.zhu@zilliz.com>
This commit is contained in:
parent
617e029dd3
commit
32c70b7f86
@ -74,9 +74,17 @@ def hello_milvus(host="127.0.0.1"):
|
|||||||
collection.create_index(field_name="float_vector", index_params=default_index)
|
collection.create_index(field_name="float_vector", index_params=default_index)
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
print(f"\nCreate index cost {t1 - t0:.4f} seconds")
|
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...")
|
print(f"\nload collection...")
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
collection.load()
|
collection.load(replica_number=replica_number)
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
print(f"\nload collection cost {t1 - t0:.4f} seconds")
|
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'])
|
sorted_res = sorted(res, key=lambda k: k['int64'])
|
||||||
for r in sorted_res:
|
for r in sorted_res:
|
||||||
print(r)
|
print(r)
|
||||||
# collection.release()
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='host ip')
|
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)
|
collection.create_index(field_name="float_vector", index_params=default_index)
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
print(f"\nCreate index cost {t1 - t0:.4f} seconds")
|
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...")
|
print(f"\nload collection...")
|
||||||
t0 = time.time()
|
t0 = time.time()
|
||||||
collection.load()
|
collection.load(replica_number=replica_number)
|
||||||
t1 = time.time()
|
t1 = time.time()
|
||||||
print(f"\nload collection cost {t1 - t0:.4f} seconds")
|
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'])
|
sorted_res = sorted(res, key=lambda k: k['int64'])
|
||||||
for r in sorted_res:
|
for r in sorted_res:
|
||||||
print(r)
|
print(r)
|
||||||
collection.release()
|
|
||||||
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='host ip')
|
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()
|
args = parser.parse_args()
|
||||||
# add time stamp
|
# add time stamp
|
||||||
print(f"\nStart time: {time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time()))}")
|
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)
|
@pytest.fixture(scope="function", autouse=True)
|
||||||
def init_health_checkers(self):
|
def init_health_checkers(self):
|
||||||
c_name = cf.gen_unique_str('Checker_')
|
c_name = cf.gen_unique_str('MultiReplicasChecker_')
|
||||||
replicas_num = 2
|
replicas_num = 2
|
||||||
shards_num = 2
|
shards_num = 2
|
||||||
checkers = {
|
checkers = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user