Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
I
inspect_report
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
zhengjinlei
inspect_report
Commits
93ddb338
Commit
93ddb338
authored
Apr 20, 2020
by
lvshibao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
static_rule第一次刷新task_id没有赋值
parent
3903486d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
75 additions
and
0 deletions
+75
-0
tasksapi.py
src/inspect_report/api/tasksapi.py
+2
-0
mysql_tools.py
src/inspect_report/utils/mysql_tools.py
+29
-0
node_test.py
tests/node_test.py
+44
-0
No files found.
src/inspect_report/api/tasksapi.py
View file @
93ddb338
...
@@ -493,6 +493,8 @@ class TasksApi(viewsets.ViewSet):
...
@@ -493,6 +493,8 @@ class TasksApi(viewsets.ViewSet):
task_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
}
task_condition
=
{
'create_date__gte'
:
q_start_date
,
'create_date__lt'
:
q_end_date
}
if
task_id
:
if
task_id
:
task_condition
[
'task'
]
=
task_id
task_condition
[
'task'
]
=
task_id
elif
username
:
task_condition
[
'task'
]
=
username
# tasks = RulesStat.objects.filter(**task_condition).values('rule', 'sessionCollectionId', 'rule_num')
# tasks = RulesStat.objects.filter(**task_condition).values('rule', 'sessionCollectionId', 'rule_num')
tasks
=
RulesStat
.
objects
.
all
()
.
filter
(
**
task_condition
)
\
tasks
=
RulesStat
.
objects
.
all
()
.
filter
(
**
task_condition
)
\
.
extra
(
select
=
{
'rule'
:
"rule"
,
'sessionCollectionId'
:
'sessionCollectionId'
})
\
.
extra
(
select
=
{
'rule'
:
"rule"
,
'sessionCollectionId'
:
'sessionCollectionId'
})
\
...
...
src/inspect_report/utils/mysql_tools.py
0 → 100644
View file @
93ddb338
import
mysql.connector
my_db
=
mysql
.
connector
.
connect
(
host
=
"172.17.1.74"
,
user
=
"root"
,
passwd
=
'123456'
,
port
=
3309
,
database
=
"b774563252"
)
my_cursor
=
my_db
.
cursor
()
print
(
my_cursor
)
my_cursor
.
execute
(
"SET FOREIGN_KEY_CHECKS = 0;"
)
my_cursor
.
execute
(
"SHOW TABLES;"
)
name_list
=
list
()
for
name
in
my_cursor
:
name_list
.
append
(
name
)
# 1。 解除关系,关系接触之后注释掉
# for name in name_list:
# sql = "alter table " + name[0] + " discard tablespace;"
# print(sql)
# my_cursor.execute(sql)
# 将备份的ibd文件解压到b774563252文件夹,并将权限和用户及组改为660和polkitd input
# 2. 建立关系,跑解除关系的时候这里注释掉
for
name
in
name_list
:
sql
=
"alter table "
+
name
[
0
]
+
" import tablespace;"
print
(
sql
)
my_cursor
.
execute
(
sql
)
my_cursor
.
execute
(
"SET FOREIGN_KEY_CHECKS = 1;"
)
tests/node_test.py
0 → 100644
View file @
93ddb338
import
hashlib
import
time
import
requests
def
get_md5_value
(
src
):
myMd5
=
hashlib
.
md5
()
myMd5
.
update
(
src
.
encode
(
encoding
=
'UTF-8'
))
myMd5_Digest
=
myMd5
.
hexdigest
()
return
myMd5_Digest
if
__name__
==
'__main__'
:
now
=
time
.
localtime
()
timestamp
=
time
.
mktime
(
now
)
key
=
'znzjxt4132'
seqno
=
str
(
int
(
timestamp
*
1000
))
flowintime
=
time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S"
,
now
)
.
replace
(
'-'
,
''
)
.
replace
(
' '
,
''
)
.
replace
(
':'
,
''
)
headers
=
{
'cmd'
:
'SendTemplateMsg'
,
'seqno'
:
seqno
,
'flowintime'
:
flowintime
,
'userid'
:
'znzjxt'
,
'token'
:
get_md5_value
(
'znzjxt'
+
seqno
+
key
)
}
data
=
{
'startTimestamp'
:
"2020-04-01 00:00:01"
,
'endTimestamp'
:
"2020-04-01 23:59:59"
,
'from'
:
1
,
'to'
:
10
}
resp
=
requests
.
post
(
'https://38.1.32.58:8443/biwebback/inface/quality/getJhTrack'
,
json
=
{
'head'
:
headers
,
'body'
:
data
},
verify
=
False
)
src
=
resp
.
json
()[
'body'
]
desc
=
list
()
for
iterm
in
src
:
if
int
(
iterm
[
'recordTime'
])
>=
60
:
desc
.
append
(
iterm
)
print
(
len
(
desc
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment