Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_35024513
milvus
提交
db42b0bd
milvus
项目概览
qq_35024513
/
milvus
与 Fork 源项目一致
Fork自
milvus / milvus
通知
14
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
milvus
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
未验证
提交
db42b0bd
编写于
4月 23, 2020
作者:
D
del-zhenwu
提交者:
GitHub
4月 23, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix case bug (#2049)
Signed-off-by:
N
zw
<
zw@zilliz.com
>
上级
9a3ae916
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
19 addition
and
61 deletion
+19
-61
tests/milvus_python_test/test_add_vectors.py
tests/milvus_python_test/test_add_vectors.py
+4
-9
tests/milvus_python_test/test_collection.py
tests/milvus_python_test/test_collection.py
+3
-11
tests/milvus_python_test/test_collection_count.py
tests/milvus_python_test/test_collection_count.py
+2
-6
tests/milvus_python_test/test_flush.py
tests/milvus_python_test/test_flush.py
+2
-5
tests/milvus_python_test/test_index.py
tests/milvus_python_test/test_index.py
+8
-30
未找到文件。
tests/milvus_python_test/test_add_vectors.py
浏览文件 @
db42b0bd
...
...
@@ -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
])
...
...
tests/milvus_python_test/test_collection.py
浏览文件 @
db42b0bd
...
...
@@ -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
()
...
...
tests/milvus_python_test/test_collection_count.py
浏览文件 @
db42b0bd
...
...
@@ -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
()
...
...
tests/milvus_python_test/test_flush.py
浏览文件 @
db42b0bd
...
...
@@ -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
])
...
...
tests/milvus_python_test/test_index.py
浏览文件 @
db42b0bd
...
...
@@ -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
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录