mirror of https://github.com/milvus-io/milvus.git
[skip ci] Disable unused class (#10390)
Signed-off-by: Binbin Lv <binbin.lv@zilliz.com>pull/10394/head
parent
c1c3f47cc1
commit
5bcf1d2be9
|
@ -14,158 +14,158 @@ supported_simd_types = ["sse4_2", "avx", "avx2", "avx512"]
|
||||||
|
|
||||||
|
|
||||||
# TODO: implement simd config after supported
|
# TODO: implement simd config after supported
|
||||||
@pytest.mark.tags(CaseLabel.L3)
|
# @pytest.mark.tags(CaseLabel.L3)
|
||||||
class TestSimdCompatibility:
|
# class TestSimdCompatibility:
|
||||||
"""
|
# """
|
||||||
steps
|
# steps
|
||||||
1. [test_milvus_install]: set up milvus with customized simd configured
|
# 1. [test_milvus_install]: set up milvus with customized simd configured
|
||||||
2. [test_simd_compat_e2e]: verify milvus is working well
|
# 2. [test_simd_compat_e2e]: verify milvus is working well
|
||||||
4. [test_milvus_cleanup]: clear the env "avx", "avx2", "avx512"
|
# 4. [test_milvus_cleanup]: clear the env "avx", "avx2", "avx512"
|
||||||
"""
|
# """
|
||||||
|
#
|
||||||
@pytest.mark.parametrize('simd', [
|
# @pytest.mark.parametrize('simd', [
|
||||||
pytest.param("sse4_2", marks=pytest.mark.dependency(name='ins_sse4_2')),
|
# pytest.param("sse4_2", marks=pytest.mark.dependency(name='ins_sse4_2')),
|
||||||
# pytest.param("avx", marks=pytest.mark.dependency(name='ins_avx')),
|
# # pytest.param("avx", marks=pytest.mark.dependency(name='ins_avx')),
|
||||||
# pytest.param("avx2", marks=pytest.mark.dependency(name='ins_avx2')),
|
# # pytest.param("avx2", marks=pytest.mark.dependency(name='ins_avx2')),
|
||||||
pytest.param("avx512", marks=pytest.mark.dependency(name='ins_avx512'))
|
# pytest.param("avx512", marks=pytest.mark.dependency(name='ins_avx512'))
|
||||||
])
|
# ])
|
||||||
def test_milvus_install(self, request, simd):
|
# def test_milvus_install(self, request, simd):
|
||||||
release_name = "mil-simd-" + cf.gen_digits_by_length(6)
|
# release_name = "mil-simd-" + cf.gen_digits_by_length(6)
|
||||||
namespace = 'chaos-testing'
|
# namespace = 'chaos-testing'
|
||||||
cus_configs = {'spec.components.image': 'milvusdb/milvus-dev:master-latest',
|
# cus_configs = {'spec.components.image': 'milvusdb/milvus-dev:master-latest',
|
||||||
'metadata.namespace': namespace,
|
# 'metadata.namespace': namespace,
|
||||||
'metadata.name': release_name,
|
# 'metadata.name': release_name,
|
||||||
'spec.components.proxy.serviceType': 'LoadBalancer',
|
# 'spec.components.proxy.serviceType': 'LoadBalancer',
|
||||||
# TODO: use simd config instead of replicas
|
# # TODO: use simd config instead of replicas
|
||||||
'spec.components.queryNode.replicas': 2
|
# 'spec.components.queryNode.replicas': 2
|
||||||
}
|
# }
|
||||||
install_milvus(cus_configs, template=template_yaml)
|
# install_milvus(cus_configs, template=template_yaml)
|
||||||
healthy = wait_for_milvus_healthy(release_name, namespace)
|
# healthy = wait_for_milvus_healthy(release_name, namespace)
|
||||||
log.info(f"milvus healthy: {healthy}")
|
# log.info(f"milvus healthy: {healthy}")
|
||||||
assert healthy
|
# assert healthy
|
||||||
endpoint = get_milvus_endpoint(release_name, namespace)
|
# endpoint = get_milvus_endpoint(release_name, namespace)
|
||||||
log.info(f"milvus endpoint: {endpoint}")
|
# log.info(f"milvus endpoint: {endpoint}")
|
||||||
host = endpoint.split(':')[0]
|
# host = endpoint.split(':')[0]
|
||||||
port = endpoint.split(':')[1]
|
# port = endpoint.split(':')[1]
|
||||||
conn = connections.connect(simd, host=host, port=port)
|
# conn = connections.connect(simd, host=host, port=port)
|
||||||
assert conn is not None
|
# assert conn is not None
|
||||||
mil = MilvusSys(alias=simd)
|
# mil = MilvusSys(alias=simd)
|
||||||
log.info(f"milvus build version: {mil.build_version}")
|
# log.info(f"milvus build version: {mil.build_version}")
|
||||||
# TODO: Verify simd config instead of replicas
|
# # TODO: Verify simd config instead of replicas
|
||||||
assert len(mil.query_nodes) == 2
|
# assert len(mil.query_nodes) == 2
|
||||||
|
#
|
||||||
# cache results for dependent tests
|
# # cache results for dependent tests
|
||||||
cache = {'release_name': release_name,
|
# cache = {'release_name': release_name,
|
||||||
'namespace': namespace,
|
# 'namespace': namespace,
|
||||||
'alias': simd,
|
# 'alias': simd,
|
||||||
'simd': simd
|
# 'simd': simd
|
||||||
}
|
# }
|
||||||
request.config.cache.set(simd, cache)
|
# request.config.cache.set(simd, cache)
|
||||||
|
#
|
||||||
@pytest.mark.parametrize('simd', [
|
# @pytest.mark.parametrize('simd', [
|
||||||
pytest.param("sse4_2", marks=pytest.mark.dependency(name='e2e_sse4_2', depends=["ins_sse4_2"])),
|
# pytest.param("sse4_2", marks=pytest.mark.dependency(name='e2e_sse4_2', depends=["ins_sse4_2"])),
|
||||||
# pytest.param("avx", marks=pytest.mark.dependency(name='e2e_avx', depends=["ins_avx"])),
|
# # pytest.param("avx", marks=pytest.mark.dependency(name='e2e_avx', depends=["ins_avx"])),
|
||||||
# pytest.param("avx2", marks=pytest.mark.dependency(name='e2e_avx2', depends=["ins_avx2"])),
|
# # pytest.param("avx2", marks=pytest.mark.dependency(name='e2e_avx2', depends=["ins_avx2"])),
|
||||||
pytest.param("avx512", marks=pytest.mark.dependency(name='e2e_avx512', depends=["ins_avx512"]))
|
# pytest.param("avx512", marks=pytest.mark.dependency(name='e2e_avx512', depends=["ins_avx512"]))
|
||||||
])
|
# ])
|
||||||
def test_simd_compat_e2e(self, request, simd):
|
# def test_simd_compat_e2e(self, request, simd):
|
||||||
log.info(f"start to e2e verification: {simd}")
|
# log.info(f"start to e2e verification: {simd}")
|
||||||
# parse results from previous results
|
# # parse results from previous results
|
||||||
results = request.config.cache.get(simd, None)
|
# results = request.config.cache.get(simd, None)
|
||||||
alias = results.get('alias', simd)
|
# alias = results.get('alias', simd)
|
||||||
conn = connections.connect(alias=alias)
|
# conn = connections.connect(alias=alias)
|
||||||
assert conn is not None
|
# assert conn is not None
|
||||||
simd_cache = request.config.cache.get(simd, None)
|
# simd_cache = request.config.cache.get(simd, None)
|
||||||
log.info(f"simd_cache: {simd_cache}")
|
# log.info(f"simd_cache: {simd_cache}")
|
||||||
# create
|
# # create
|
||||||
name = cf.gen_unique_str("compat")
|
# name = cf.gen_unique_str("compat")
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
collection_w = ApiCollectionWrapper()
|
# collection_w = ApiCollectionWrapper()
|
||||||
collection_w.init_collection(name=name,
|
# collection_w.init_collection(name=name,
|
||||||
schema=cf.gen_default_collection_schema(),
|
# schema=cf.gen_default_collection_schema(),
|
||||||
using=alias,
|
# using=alias,
|
||||||
timeout=40)
|
# timeout=40)
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
assert collection_w.name == name
|
# assert collection_w.name == name
|
||||||
entities = collection_w.num_entities
|
# entities = collection_w.num_entities
|
||||||
log.info(f"assert create collection: {tt}, init_entities: {entities}")
|
# log.info(f"assert create collection: {tt}, init_entities: {entities}")
|
||||||
|
#
|
||||||
# insert
|
# # insert
|
||||||
data = cf.gen_default_list_data()
|
# data = cf.gen_default_list_data()
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
_, res = collection_w.insert(data)
|
# _, res = collection_w.insert(data)
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert insert: {tt}")
|
# log.info(f"assert insert: {tt}")
|
||||||
assert res
|
# assert res
|
||||||
|
#
|
||||||
# flush
|
# # flush
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
assert collection_w.num_entities == len(data[0]) + entities
|
# assert collection_w.num_entities == len(data[0]) + entities
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
entities = collection_w.num_entities
|
# entities = collection_w.num_entities
|
||||||
log.info(f"assert flush: {tt}, entities: {entities}")
|
# log.info(f"assert flush: {tt}, entities: {entities}")
|
||||||
|
#
|
||||||
# search
|
# # search
|
||||||
collection_w.load()
|
# collection_w.load()
|
||||||
search_vectors = cf.gen_vectors(1, ct.default_dim)
|
# search_vectors = cf.gen_vectors(1, ct.default_dim)
|
||||||
search_params = {"metric_type": "L2", "params": {"nprobe": 16}}
|
# search_params = {"metric_type": "L2", "params": {"nprobe": 16}}
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
res_1, _ = collection_w.search(data=search_vectors,
|
# res_1, _ = collection_w.search(data=search_vectors,
|
||||||
anns_field=ct.default_float_vec_field_name,
|
# anns_field=ct.default_float_vec_field_name,
|
||||||
param=search_params, limit=1)
|
# param=search_params, limit=1)
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert search: {tt}")
|
# log.info(f"assert search: {tt}")
|
||||||
assert len(res_1) == 1
|
# assert len(res_1) == 1
|
||||||
collection_w.release()
|
# collection_w.release()
|
||||||
|
#
|
||||||
# index
|
# # index
|
||||||
d = cf.gen_default_list_data()
|
# d = cf.gen_default_list_data()
|
||||||
collection_w.insert(d)
|
# collection_w.insert(d)
|
||||||
log.info(f"assert index entities: {collection_w.num_entities}")
|
# log.info(f"assert index entities: {collection_w.num_entities}")
|
||||||
_index_params = {"index_type": "IVF_SQ8", "params": {"nlist": 64}, "metric_type": "L2"}
|
# _index_params = {"index_type": "IVF_SQ8", "params": {"nlist": 64}, "metric_type": "L2"}
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
index, _ = collection_w.create_index(field_name=ct.default_float_vec_field_name,
|
# index, _ = collection_w.create_index(field_name=ct.default_float_vec_field_name,
|
||||||
index_params=_index_params,
|
# index_params=_index_params,
|
||||||
name=cf.gen_unique_str())
|
# name=cf.gen_unique_str())
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert index: {tt}")
|
# log.info(f"assert index: {tt}")
|
||||||
assert len(collection_w.indexes) == 1
|
# assert len(collection_w.indexes) == 1
|
||||||
|
#
|
||||||
# search
|
# # search
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
collection_w.load()
|
# collection_w.load()
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert load: {tt}")
|
# log.info(f"assert load: {tt}")
|
||||||
search_vectors = cf.gen_vectors(1, ct.default_dim)
|
# search_vectors = cf.gen_vectors(1, ct.default_dim)
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
res_1, _ = collection_w.search(data=search_vectors,
|
# res_1, _ = collection_w.search(data=search_vectors,
|
||||||
anns_field=ct.default_float_vec_field_name,
|
# anns_field=ct.default_float_vec_field_name,
|
||||||
param=search_params, limit=1)
|
# param=search_params, limit=1)
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert search: {tt}")
|
# log.info(f"assert search: {tt}")
|
||||||
|
#
|
||||||
# query
|
# # query
|
||||||
term_expr = f'{ct.default_int64_field_name} in [1001,1201,4999,2999]'
|
# term_expr = f'{ct.default_int64_field_name} in [1001,1201,4999,2999]'
|
||||||
t0 = time.time()
|
# t0 = time.time()
|
||||||
res, _ = collection_w.query(term_expr)
|
# res, _ = collection_w.query(term_expr)
|
||||||
tt = time.time() - t0
|
# tt = time.time() - t0
|
||||||
log.info(f"assert query result {len(res)}: {tt}")
|
# log.info(f"assert query result {len(res)}: {tt}")
|
||||||
|
#
|
||||||
@pytest.mark.parametrize('simd', [
|
# @pytest.mark.parametrize('simd', [
|
||||||
pytest.param("sse4_2", marks=pytest.mark.dependency(name='clear_sse4_2', depends=["ins_sse4_2", "e2e_sse4_2"])),
|
# pytest.param("sse4_2", marks=pytest.mark.dependency(name='clear_sse4_2', depends=["ins_sse4_2", "e2e_sse4_2"])),
|
||||||
# pytest.param("avx", marks=pytest.mark.dependency(name='clear_avx', depends=["ins_avx", "e2e_avx"])),
|
# # pytest.param("avx", marks=pytest.mark.dependency(name='clear_avx', depends=["ins_avx", "e2e_avx"])),
|
||||||
# pytest.param("avx2", marks=pytest.mark.dependency(name='clear_avx2', depends=["ins_avx2", "e2e_avx2"])),
|
# # pytest.param("avx2", marks=pytest.mark.dependency(name='clear_avx2', depends=["ins_avx2", "e2e_avx2"])),
|
||||||
pytest.param("avx512", marks=pytest.mark.dependency(name='clear_avx512', depends=["ins_avx512", "e2e_avx512"]))
|
# pytest.param("avx512", marks=pytest.mark.dependency(name='clear_avx512', depends=["ins_avx512", "e2e_avx512"]))
|
||||||
])
|
# ])
|
||||||
def test_milvus_cleanup(self, request, simd):
|
# def test_milvus_cleanup(self, request, simd):
|
||||||
# get release name from previous results
|
# # get release name from previous results
|
||||||
results = request.config.cache.get(simd, None)
|
# results = request.config.cache.get(simd, None)
|
||||||
release_name = results.get('release_name', "name-not-found")
|
# release_name = results.get('release_name', "name-not-found")
|
||||||
namespace = results.get('namespace', "namespace-not-found")
|
# namespace = results.get('namespace', "namespace-not-found")
|
||||||
simd_cache = request.config.cache.get(simd, None)
|
# simd_cache = request.config.cache.get(simd, None)
|
||||||
log.info(f"stat to cleanup: {simd}")
|
# log.info(f"stat to cleanup: {simd}")
|
||||||
log.info(f"simd_cache: {simd_cache}")
|
# log.info(f"simd_cache: {simd_cache}")
|
||||||
log.info(f"release_name: {release_name}")
|
# log.info(f"release_name: {release_name}")
|
||||||
log.info(f"namespace: {namespace}")
|
# log.info(f"namespace: {namespace}")
|
||||||
|
#
|
||||||
uninstall_milvus(release_name, namespace)
|
# uninstall_milvus(release_name, namespace)
|
||||||
|
|
Loading…
Reference in New Issue