Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wsmonitor_sql
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
宋鹏博
wsmonitor_sql
Commits
61875236
Commit
61875236
authored
Nov 24, 2025
by
杨基红
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add dochub task monitor
parent
42420469
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
86 additions
and
5 deletions
+86
-5
DButils_dochub.py
common/DButils_dochub.py
+72
-0
cutils.py
common/cutils.py
+7
-5
config.py
config.py
+7
-0
No files found.
common/DButils_dochub.py
0 → 100644
View file @
61875236
# mysql数据库
import
pymysql
from
config
import
host2
,
user2
,
database_pwd2
,
database2
,
port2
class
DButils_dochub
:
__conn
=
None
__cursor
=
None
# 连接数据库
@classmethod
def
get_conn
(
cls
):
if
cls
.
__conn
is
None
:
cls
.
__conn
=
pymysql
.
connect
(
host
=
host2
,
port
=
port2
,
user
=
user2
,
password
=
database_pwd2
,
database
=
database2
,
charset
=
"utf8"
)
return
cls
.
__conn
# 创建游标方法
@classmethod
def
get_cursor
(
cls
):
if
cls
.
__cursor
is
None
:
cls
.
__cursor
=
cls
.
get_conn
()
.
cursor
()
return
cls
.
__cursor
# sql执行查询方法
@classmethod
def
select_sql
(
cls
,
sql
):
result
=
None
try
:
cursor
=
cls
.
get_cursor
()
cursor
.
execute
(
sql
)
result
=
cursor
.
fetchall
()
except
Exception
as
e
:
print
(
e
)
finally
:
cls
.
close_cursor
()
cls
.
close_conn
()
return
result
# 数据库的增删改操作
@classmethod
def
uid_sql
(
cls
,
sql
):
try
:
conn
=
cls
.
get_conn
()
cursor
=
cls
.
get_cursor
()
cursor
.
execute
(
sql
)
conn
.
commit
()
except
Exception
as
e
:
print
(
e
)
cls
.
get_conn
()
.
rollback
()
finally
:
cls
.
close_cursor
()
cls
.
close_conn
()
# 关闭游标方法
@classmethod
def
close_cursor
(
cls
):
if
cls
.
__cursor
:
cls
.
__cursor
.
close
()
cls
.
__cursor
=
None
# 关闭连接
@classmethod
def
close_conn
(
cls
):
if
cls
.
__conn
:
cls
.
__conn
.
close
()
cls
.
__conn
=
None
common/cutils.py
View file @
61875236
...
@@ -5,6 +5,7 @@ import requests
...
@@ -5,6 +5,7 @@ import requests
from
common.DButils
import
DButils
from
common.DButils
import
DButils
from
common.DButils_aireview
import
DButils_aireview
from
common.DButils_aireview
import
DButils_aireview
from
common.DButils_dochub
import
DButils_dochub
from
config
import
wechaturl
,
error_answer
,
file_path
,
aireview_task_url
from
config
import
wechaturl
,
error_answer
,
file_path
,
aireview_task_url
...
@@ -44,12 +45,12 @@ def mk_error_message(error_editor, error_answer, message_id, url=wechaturl):
...
@@ -44,12 +45,12 @@ def mk_error_message(error_editor, error_answer, message_id, url=wechaturl):
requests
.
post
(
url
,
json
=
data
)
requests
.
post
(
url
,
json
=
data
)
def
task_count
(
semantics_task_count
,
ideology_task_count
,
validate_logic_task_count
,
knowledge_task_count
,
def
task_count
(
semantics_task_count
,
ideology_task_count
,
validate_logic_task_count
,
knowledge_task_count
,
dochub_task_count
,
url
=
wechaturl
):
url
=
wechaturl
):
data
=
{
data
=
{
"msgtype"
:
"markdown"
,
"msgtype"
:
"markdown"
,
"markdown"
:
{
"markdown"
:
{
"content"
:
f
"审校任务排队情况<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>语义任务:<font color=
\"
comment
\"
>{semantics_task_count}</font>
\n
内容风险任务:<font color=
\"
comment
\"
>{ideology_task_count}</font>
\n
逻辑检查任务:<font color=
\"
comment
\"
>{validate_logic_task_count}</font>
\n
知识性差错任务:<font color=
\"
comment
\"
>{knowledge_task_count}</font> "
"content"
:
f
"审校任务排队情况<font color=
\"
warning
\"
>异常</font>,请相关同事注意。
\n
>语义任务:<font color=
\"
comment
\"
>{semantics_task_count}</font>
\n
内容风险任务:<font color=
\"
comment
\"
>{ideology_task_count}</font>
\n
逻辑检查任务:<font color=
\"
comment
\"
>{validate_logic_task_count}</font>
\n
知识性差错任务:<font color=
\"
comment
\"
>{knowledge_task_count}</font>
\n
文档解析批注任务:<font color=
\"
comment
\"
>{dochub_task_count}</font>
"
}
}
}
}
requests
.
post
(
url
,
json
=
data
)
requests
.
post
(
url
,
json
=
data
)
...
@@ -81,7 +82,8 @@ def aireview_task():
...
@@ -81,7 +82,8 @@ def aireview_task():
"select count(*) from aireview.validate_logic_task where create_time >date(now()) and status =0;"
)
"select count(*) from aireview.validate_logic_task where create_time >date(now()) and status =0;"
)
knowledge_task_count
=
DButils_aireview
()
.
select_sql
(
knowledge_task_count
=
DButils_aireview
()
.
select_sql
(
"select count(*) from aireview.knowledge_task kt2 where create_time >date(now()) and status =0;"
)
"select count(*) from aireview.knowledge_task kt2 where create_time >date(now()) and status =0;"
)
dochub_task_count
=
DButils_dochub
()
.
select_sql
(
if
semantics_task_count
[
0
][
0
]
>
60000
or
ideology_task_count
[
0
][
0
]
>
20000
or
validate_logic_task_count
[
0
][
0
]
>
20000
or
knowledge_task_count
[
0
][
0
]
>
20000
:
"select count(*) from document_record where status in (0,1) and create_time >=CURDATE();"
)
task_count
(
semantics_task_count
[
0
][
0
],
ideology_task_count
[
0
][
0
],
validate_logic_task_count
[
0
][
0
],
knowledge_task_count
[
0
][
0
],
url
=
aireview_task_url
)
if
semantics_task_count
[
0
][
0
]
>
60000
or
ideology_task_count
[
0
][
0
]
>
20000
or
validate_logic_task_count
[
0
][
0
]
>
20000
or
knowledge_task_count
[
0
][
0
]
>
20000
or
dochub_task_count
[
0
][
0
]
>
500
:
task_count
(
semantics_task_count
[
0
][
0
],
ideology_task_count
[
0
][
0
],
validate_logic_task_count
[
0
][
0
],
knowledge_task_count
[
0
][
0
],
dochub_task_count
[
0
][
0
],
url
=
aireview_task_url
)
config.py
View file @
61875236
...
@@ -13,6 +13,13 @@ database1 = "aireview"
...
@@ -13,6 +13,13 @@ database1 = "aireview"
port1
=
3306
port1
=
3306
import
os
import
os
# 生产环境doc_hub数据库
host2
=
"192.168.8.234"
user2
=
"docuhub110"
database_pwd2
=
"C4euFavC"
database2
=
"docuhub"
port2
=
3306
# 生产环境aicaption数据库
# 生产环境aicaption数据库
host
=
"192.168.8.234"
host
=
"192.168.8.234"
user
=
"aicaptain110"
user
=
"aicaptain110"
...
...
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