Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
taosdata
TDengine
提交
f81a57df
T
TDengine
项目概览
taosdata
/
TDengine
1 年多 前同步成功
通知
1185
Star
22016
Fork
4786
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
TDengine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
f81a57df
编写于
12月 10, 2020
作者:
L
liuyq-617
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'test/jenkins' of github.com:taosdata/TDengine into test/jenkins
上级
4c3f7a5d
cafea44a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
99 addition
and
18 deletion
+99
-18
tests/Jenkinsfile
tests/Jenkinsfile
+3
-1
tests/pytest/concurrent_inquiry.py
tests/pytest/concurrent_inquiry.py
+96
-17
未找到文件。
tests/Jenkinsfile
浏览文件 @
f81a57df
properties
([
pipelineTriggers
([
githubPush
()])])
properties
([
pipelineTriggers
([
githubPush
()])])
node
{
node
{
git
url:
'https://github.com/taosdata/TDengine
.git
'
git
url:
'https://github.com/taosdata/TDengine'
}
}
// execute this before anything else, including requesting any time on an agent
// execute this before anything else, including requesting any time on an agent
if
(
currentBuild
.
rawBuild
.
getCauses
().
toString
().
contains
(
'BranchIndexingCause'
))
{
if
(
currentBuild
.
rawBuild
.
getCauses
().
toString
().
contains
(
'BranchIndexingCause'
))
{
print
"INFO: Build skipped due to trigger being Branch Indexing"
print
"INFO: Build skipped due to trigger being Branch Indexing"
...
...
tests/pytest/concurrent_inquiry.py
浏览文件 @
f81a57df
...
@@ -43,7 +43,8 @@ class ConcurrentInquiry:
...
@@ -43,7 +43,8 @@ class ConcurrentInquiry:
self
.
subtb_stru_list
=
[]
self
.
subtb_stru_list
=
[]
self
.
stb_tag_list
=
[]
self
.
stb_tag_list
=
[]
self
.
subtb_tag_list
=
[]
self
.
subtb_tag_list
=
[]
self
.
probabilities
=
[
0.95
,
0.05
]
self
.
ifjoin
=
[
0
,
1
]
def
SetThreadsNum
(
self
,
num
):
def
SetThreadsNum
(
self
,
num
):
self
.
numOfTherads
=
num
self
.
numOfTherads
=
num
...
@@ -105,7 +106,7 @@ class ConcurrentInquiry:
...
@@ -105,7 +106,7 @@ class ConcurrentInquiry:
conn
.
close
()
conn
.
close
()
#query condition
#query condition
def
con_where
(
self
,
tlist
):
def
con_where
(
self
,
tlist
,
col_list
,
tag_list
):
l
=
[]
l
=
[]
for
i
in
range
(
random
.
randint
(
0
,
len
(
tlist
))):
for
i
in
range
(
random
.
randint
(
0
,
len
(
tlist
))):
c
=
random
.
choice
(
where_list
)
c
=
random
.
choice
(
where_list
)
...
@@ -115,19 +116,26 @@ class ConcurrentInquiry:
...
@@ -115,19 +116,26 @@ class ConcurrentInquiry:
l
.
append
(
random
.
choice
(
tlist
)
+
c
)
l
.
append
(
random
.
choice
(
tlist
)
+
c
)
return
'where '
+
random
.
choice
([
' and '
,
' or '
]).
join
(
l
)
return
'where '
+
random
.
choice
([
' and '
,
' or '
]).
join
(
l
)
def
con_interval
(
self
,
tlist
):
def
con_interval
(
self
,
tlist
,
col_list
,
tag_list
):
return
random
.
choice
([
'interval(10s)'
,
'interval(10d)'
,
'interval(1n)'
])
interval
=
'interval'
+
str
(
random
.
randint
(
0
,
100
))
+
random
.
choice
([
'a'
,
's'
,
'd'
,
'w'
,
'n'
,
'y'
])
return
interval
def
con_limit
(
self
,
tlist
):
def
con_limit
(
self
,
tlist
,
col_list
,
tag_list
):
return
random
.
choice
([
'limit 10'
,
'limit 10 offset 10'
,
'slimit 10'
,
'slimit 10 offset 10'
,
'limit 10 slimit 10'
,
'limit 10 offset 5 slimit 5 soffset 10'
])
rand1
=
str
(
random
.
randint
(
0
,
1000
))
rand2
=
str
(
random
.
randint
(
0
,
1000
))
return
random
.
choice
([
'limit '
+
rand1
,
'limit '
+
rand1
+
'offset '
+
rand2
,
'slimit '
+
rand1
,
'slimit '
+
rand1
+
'offset '
+
rand2
,
'limit '
+
rand1
+
'slimit '
+
rand2
,
'limit '
+
rand1
+
'offset'
+
rand2
+
'slimit '
+
rand1
+
'soffset '
+
rand2
])
def
con_fill
(
self
,
tlist
):
def
con_fill
(
self
,
tlist
,
col_list
,
tag_list
):
return
random
.
choice
([
'fill(null)'
,
'fill(prev)'
,
'fill(none)'
,
'fill(LINEAR)'
])
return
random
.
choice
([
'fill(null)'
,
'fill(prev)'
,
'fill(none)'
,
'fill(LINEAR)'
])
def
con_group
(
self
,
tlist
):
def
con_group
(
self
,
tlist
,
col_list
,
tag_list
):
return
'group by '
+
random
.
choice
(
tlist
)
rand_tag
=
random
.
randint
(
0
,
5
)
rand_col
=
random
.
randint
(
0
,
1
)
return
'group by '
+
','
.
join
(
random
.
sample
(
col_list
,
rand_col
))
+
','
.
join
(
random
.
sample
(
tag_list
,
rand_tag
))
def
con_order
(
self
,
tlist
):
def
con_order
(
self
,
tlist
,
col_list
,
tag_list
):
return
'order by '
+
random
.
choice
(
tlist
)
return
'order by '
+
random
.
choice
(
tlist
)
def
gen_query_sql
(
self
):
#生成查询语句
def
gen_query_sql
(
self
):
#生成查询语句
...
@@ -158,22 +166,87 @@ class ConcurrentInquiry:
...
@@ -158,22 +166,87 @@ class ConcurrentInquiry:
sel_col_list
=
[]
sel_col_list
=
[]
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
for
i
,
j
in
zip
(
col_list
[
0
:
col_rand
],
func_list
):
#决定每个被查询col的函数
for
i
,
j
in
zip
(
col_list
[
0
:
col_rand
],
func_list
):
#决定每个被查询col的函数
alias
=
'as '
+
str
(
i
)
pick_func
=
''
if
j
==
'leastsquares'
:
if
j
==
'leastsquares'
:
sel_col_list
.
append
(
j
+
'('
+
i
+
',1,1)'
)
pick_func
=
j
+
'('
+
i
+
',1,1)'
elif
j
==
'top'
or
j
==
'bottom'
or
j
==
'percentile'
or
j
==
'apercentile'
:
elif
j
==
'top'
or
j
==
'bottom'
or
j
==
'percentile'
or
j
==
'apercentile'
:
sel_col_list
.
append
(
j
+
'('
+
i
+
',1)'
)
pick_func
=
j
+
'('
+
i
+
',1)'
else
:
else
:
sel_col_list
.
append
(
j
+
'('
+
i
+
')'
)
pick_func
=
j
+
'('
+
i
+
')'
if
bool
(
random
.
getrandbits
(
1
)):
pick_func
+=
alias
sel_col_list
.
append
(
pick_func
)
sql
=
sql
+
','
.
join
(
sel_col_list
)
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
#select col & func
sql
=
sql
+
','
.
join
(
sel_col_list
)
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
#select col & func
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con_list
=
[]
sel_con_list
=
[]
for
i
in
sel_con
:
for
i
in
sel_con
:
sel_con_list
.
append
(
i
(
tlist
))
#获取对应的条件函数
sel_con_list
.
append
(
i
(
tlist
,
col_list
,
tag_list
))
#获取对应的条件函数
sql
+=
' '
.
join
(
sel_con_list
)
# condition
sql
+=
' '
.
join
(
sel_con_list
)
# condition
print
(
sql
)
print
(
sql
)
return
sql
return
sql
def
gen_query_join
(
self
):
#生成join查询语句
tbi
=
random
.
randint
(
0
,
len
(
self
.
subtb_list
)
+
len
(
self
.
stb_list
))
#随机决定查询哪张表
tbname
=
''
col_list
=
[]
tag_list
=
[]
is_stb
=
0
if
tbi
>
len
(
self
.
stb_list
)
:
tbi
=
tbi
-
len
(
self
.
stb_list
)
tbname
=
self
.
subtb_list
[
tbi
-
1
]
col_list
=
self
.
subtb_stru_list
[
tbi
-
1
]
tag_list
=
self
.
subtb_tag_list
[
tbi
-
1
]
else
:
tbname
=
self
.
stb_list
[
tbi
-
1
]
col_list
=
self
.
stb_stru_list
[
tbi
-
1
]
tag_list
=
self
.
stb_tag_list
[
tbi
-
1
]
is_stb
=
1
tlist
=
col_list
+
tag_list
+
[
'abc'
]
#增加不存在的域'abc',是否会引起新bug
con_rand
=
random
.
randint
(
0
,
len
(
condition_list
))
func_rand
=
random
.
randint
(
0
,
len
(
func_list
))
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
tag_rand
=
random
.
randint
(
0
,
len
(
tag_list
))
t_rand
=
random
.
randint
(
0
,
len
(
tlist
))
sql
=
'select '
#select
random
.
shuffle
(
col_list
)
random
.
shuffle
(
func_list
)
sel_col_list
=
[]
col_rand
=
random
.
randint
(
0
,
len
(
col_list
))
for
i
,
j
in
zip
(
col_list
[
0
:
col_rand
],
func_list
):
#决定每个被查询col的函数
alias
=
'as '
+
str
(
i
)
pick_func
=
''
if
j
==
'leastsquares'
:
pick_func
=
j
+
'('
+
i
+
',1,1)'
elif
j
==
'top'
or
j
==
'bottom'
or
j
==
'percentile'
or
j
==
'apercentile'
:
pick_func
=
j
+
'('
+
i
+
',1)'
else
:
pick_func
=
j
+
'('
+
i
+
')'
if
bool
(
random
.
getrandbits
(
1
)):
pick_func
+=
alias
sel_col_list
.
append
(
pick_func
)
sql
=
sql
+
','
.
join
(
sel_col_list
)
+
' from '
+
random
.
choice
(
self
.
stb_list
+
self
.
subtb_list
)
+
' '
#select col & func
con_func
=
[
self
.
con_where
,
self
.
con_interval
,
self
.
con_limit
,
self
.
con_group
,
self
.
con_order
,
self
.
con_fill
]
sel_con
=
random
.
sample
(
con_func
,
random
.
randint
(
0
,
len
(
con_func
)))
sel_con_list
=
[]
for
i
in
sel_con
:
sel_con_list
.
append
(
i
(
tlist
,
col_list
,
tag_list
))
#获取对应的条件函数
sql
+=
' '
.
join
(
sel_con_list
)
# condition
print
(
sql
)
return
sql
def
random_pick
(
self
):
x
=
random
.
uniform
(
0
,
1
)
cumulative_probability
=
0.0
for
item
,
item_probability
in
zip
(
self
.
ifjoin
,
self
.
probabilities
):
cumulative_probability
+=
item_probability
if
x
<
cumulative_probability
:
break
return
item
def
rest_query
(
self
,
sql
):
#rest 接口
def
rest_query
(
self
,
sql
):
#rest 接口
host
=
"127.0.0.1"
host
=
"127.0.0.1"
user
=
"root"
user
=
"root"
...
@@ -210,6 +283,7 @@ class ConcurrentInquiry:
...
@@ -210,6 +283,7 @@ class ConcurrentInquiry:
nRows
=
rj
[
'rows'
]
if
(
'rows'
in
rj
)
else
0
nRows
=
rj
[
'rows'
]
if
(
'rows'
in
rj
)
else
0
return
nRows
return
nRows
def
query_thread_n
(
self
,
threadID
):
#使用原生python接口查询
def
query_thread_n
(
self
,
threadID
):
#使用原生python接口查询
host
=
"127.0.0.1"
host
=
"127.0.0.1"
user
=
"root"
user
=
"root"
...
@@ -227,7 +301,10 @@ class ConcurrentInquiry:
...
@@ -227,7 +301,10 @@ class ConcurrentInquiry:
while
True
:
while
True
:
try
:
try
:
sql
=
self
.
gen_query_sql
()
if
self
.
random_pick
():
sql
=
self
.
gen_query_sql
()
else
:
sql
=
self
.
gen_query_join
()
print
(
"sql is "
,
sql
)
print
(
"sql is "
,
sql
)
start
=
time
.
time
()
start
=
time
.
time
()
cl
.
execute
(
sql
)
cl
.
execute
(
sql
)
...
@@ -247,7 +324,10 @@ class ConcurrentInquiry:
...
@@ -247,7 +324,10 @@ class ConcurrentInquiry:
print
(
"Thread %d: starting"
%
threadID
)
print
(
"Thread %d: starting"
%
threadID
)
while
True
:
while
True
:
try
:
try
:
sql
=
self
.
gen_query_sql
()
if
self
.
random_pick
():
sql
=
self
.
gen_query_sql
()
else
:
sql
=
self
.
gen_query_join
()
print
(
"sql is "
,
sql
)
print
(
"sql is "
,
sql
)
start
=
time
.
time
()
start
=
time
.
time
()
self
.
rest_query
(
sql
)
self
.
rest_query
(
sql
)
...
@@ -270,7 +350,6 @@ class ConcurrentInquiry:
...
@@ -270,7 +350,6 @@ class ConcurrentInquiry:
threads
.
append
(
thread
)
threads
.
append
(
thread
)
thread
.
start
()
thread
.
start
()
for
i
in
range
(
self
.
r_numOfTherads
):
for
i
in
range
(
self
.
r_numOfTherads
):
# for i in range(1):
thread
=
threading
.
Thread
(
target
=
self
.
query_thread_r
,
args
=
(
i
,))
thread
=
threading
.
Thread
(
target
=
self
.
query_thread_r
,
args
=
(
i
,))
threads
.
append
(
thread
)
threads
.
append
(
thread
)
thread
.
start
()
thread
.
start
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录