mirror of https://github.com/milvus-io/milvus.git
parent
9a3ae916a2
commit
db42b0bd94
|
@ -589,20 +589,18 @@ class TestAddBase:
|
|||
expected: status ok and result length is equal to the length off added vectors
|
||||
'''
|
||||
collection = gen_unique_str()
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
param = {'collection_name': collection,
|
||||
'dimension': dim,
|
||||
'index_file_size': index_file_size,
|
||||
'metric_type': MetricType.L2}
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
milvus.create_collection(param)
|
||||
vector = gen_single_vector(dim)
|
||||
process_num = 4
|
||||
loop_num = 5
|
||||
processes = []
|
||||
def add():
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
i = 0
|
||||
while i < loop_num:
|
||||
|
@ -634,19 +632,16 @@ class TestAddBase:
|
|||
thread_num = 8
|
||||
threads = []
|
||||
collection = gen_unique_str()
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
param = {'collection_name': collection,
|
||||
'dimension': dim,
|
||||
'index_file_size': index_file_size,
|
||||
'metric_type': MetricType.L2}
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
milvus.create_collection(param)
|
||||
vectors = gen_vectors(nb, dim)
|
||||
def add(thread_i):
|
||||
logging.getLogger().info("In thread-%d" % thread_i)
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
status, result = milvus.add_vectors(collection, records=vectors)
|
||||
assert status.OK()
|
||||
status = milvus.flush([collection])
|
||||
|
|
|
@ -322,7 +322,6 @@ class TestCollection:
|
|||
expected: collection_name equals with the collection name created
|
||||
'''
|
||||
collection_name = gen_unique_str("test_collection")
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
param = {'collection_name': collection_name,
|
||||
'dimension': dim,
|
||||
'index_file_size': index_file_size,
|
||||
|
@ -336,8 +335,7 @@ class TestCollection:
|
|||
process_num = 4
|
||||
processes = []
|
||||
for i in range(process_num):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=describecollection, args=(milvus,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
@ -507,8 +505,6 @@ class TestCollection:
|
|||
'''
|
||||
process_num = 6
|
||||
processes = []
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
def deletecollection(milvus):
|
||||
status = milvus.drop_collection(collection)
|
||||
# assert not status.code==0
|
||||
|
@ -516,8 +512,7 @@ class TestCollection:
|
|||
assert status.OK()
|
||||
|
||||
for i in range(process_num):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=deletecollection, args=(milvus,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
@ -786,13 +781,11 @@ class TestCollection:
|
|||
expected: collection_name in show collections
|
||||
'''
|
||||
collection_name = gen_unique_str("test_collection")
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
param = {'collection_name': collection_name,
|
||||
'dimension': dim,
|
||||
'index_file_size': index_file_size,
|
||||
'metric_type': MetricType.L2}
|
||||
connect.create_collection(param)
|
||||
|
||||
def showcollections(milvus):
|
||||
status, result = milvus.show_collections()
|
||||
assert status.OK()
|
||||
|
@ -802,8 +795,7 @@ class TestCollection:
|
|||
processes = []
|
||||
|
||||
for i in range(process_num):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=showcollections, args=(milvus,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
|
|
@ -181,7 +181,6 @@ class TestCollectionCount:
|
|||
expected: the count is equal to the length of vectors
|
||||
'''
|
||||
nq = 2
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
vectors = gen_vectors(nq, dim)
|
||||
res = connect.add_vectors(collection_name=collection, records=vectors)
|
||||
time.sleep(add_time_interval)
|
||||
|
@ -194,8 +193,7 @@ class TestCollectionCount:
|
|||
process_num = 8
|
||||
processes = []
|
||||
for i in range(process_num):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=rows_count, args=(milvus, ))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
@ -326,7 +324,6 @@ class TestCollectionCountIP:
|
|||
expected: the count is equal to the length of vectors
|
||||
'''
|
||||
nq = 2
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
vectors = gen_vectors(nq, dim)
|
||||
res = connect.add_vectors(collection_name=ip_collection, records=vectors)
|
||||
time.sleep(add_time_interval)
|
||||
|
@ -339,8 +336,7 @@ class TestCollectionCountIP:
|
|||
process_num = 8
|
||||
processes = []
|
||||
for i in range(process_num):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=rows_count, args=(milvus,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
|
|
@ -203,19 +203,16 @@ class TestFlushBase:
|
|||
expected: status ok
|
||||
'''
|
||||
collection = gen_unique_str()
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
param = {'collection_name': collection,
|
||||
'dimension': dim,
|
||||
'index_file_size': index_file_size,
|
||||
'metric_type': MetricType.L2}
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
milvus.create_collection(param)
|
||||
vectors = gen_vector(nb, dim)
|
||||
status, ids = milvus.add_vectors(collection, vectors, ids=[i for i in range(nb)])
|
||||
def flush(collection_name):
|
||||
milvus = get_milvus(args["handler"])
|
||||
milvus.connect(uri=uri)
|
||||
milvus = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
status = milvus.delete_by_id(collection_name, [i for i in range(nb)])
|
||||
assert status.OK()
|
||||
status = milvus.flush([collection_name])
|
||||
|
|
|
@ -166,11 +166,8 @@ class TestIndexBase:
|
|||
|
||||
threads_num = 8
|
||||
threads = []
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(threads_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
t = threading.Thread(target=build, args=(m,))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
|
@ -197,7 +194,6 @@ class TestIndexBase:
|
|||
threads_num = 8
|
||||
loop_num = 8
|
||||
threads = []
|
||||
|
||||
collection = []
|
||||
j = 0
|
||||
while j < (threads_num*loop_num):
|
||||
|
@ -215,7 +211,6 @@ class TestIndexBase:
|
|||
while i < loop_num:
|
||||
# assert connect.has_collection(collection[ids*process_num+i])
|
||||
status, ids = connect.add_vectors(collection[ids*threads_num+i], vectors)
|
||||
|
||||
status = connect.create_index(collection[ids*threads_num+i], IndexType.IVFLAT, {"nlist": NLIST})
|
||||
assert status.OK()
|
||||
query_vec = [vectors[0]]
|
||||
|
@ -226,14 +221,10 @@ class TestIndexBase:
|
|||
assert len(result[0]) == top_k
|
||||
assert result[0][0].distance == 0.0
|
||||
i = i + 1
|
||||
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(threads_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
ids = i
|
||||
t = threading.Thread(target=create_index, args=(m,ids))
|
||||
t = threading.Thread(target=create_index, args=(m, ids))
|
||||
threads.append(t)
|
||||
t.start()
|
||||
time.sleep(0.2)
|
||||
|
@ -256,8 +247,7 @@ class TestIndexBase:
|
|||
threads = []
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
for i in range(threads_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
if(i % 2 == 0):
|
||||
p = threading.Thread(target=build, args=(m,))
|
||||
else:
|
||||
|
@ -286,11 +276,8 @@ class TestIndexBase:
|
|||
|
||||
process_num = 8
|
||||
processes = []
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(process_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
p = Process(target=build, args=(m,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
@ -347,11 +334,8 @@ class TestIndexBase:
|
|||
assert result[0][0].distance == 0.0
|
||||
i = i + 1
|
||||
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(process_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(host=args["ip"], port=args["port"], handler=args["handler"])
|
||||
ids = i
|
||||
p = Process(target=create_index, args=(m,ids))
|
||||
processes.append(p)
|
||||
|
@ -792,18 +776,15 @@ class TestIndexIP:
|
|||
expected: return code equals to 0, and search success
|
||||
'''
|
||||
status, ids = connect.add_vectors(ip_collection, vectors)
|
||||
|
||||
def build(connect):
|
||||
status = connect.create_index(ip_collection, IndexType.IVFLAT, {"nlist": NLIST})
|
||||
assert status.OK()
|
||||
|
||||
process_num = 8
|
||||
processes = []
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(process_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
p = Process(target=build, args=(m,))
|
||||
processes.append(p)
|
||||
p.start()
|
||||
|
@ -858,11 +839,8 @@ class TestIndexIP:
|
|||
assert result[0][0].distance == 0.0
|
||||
i = i + 1
|
||||
|
||||
uri = "tcp://%s:%s" % (args["ip"], args["port"])
|
||||
|
||||
for i in range(process_num):
|
||||
m = get_milvus(args["handler"])
|
||||
m.connect(uri=uri)
|
||||
m = get_milvus(args["ip"], args["port"], handler=args["handler"])
|
||||
ids = i
|
||||
p = Process(target=create_index, args=(m,ids))
|
||||
processes.append(p)
|
||||
|
|
Loading…
Reference in New Issue