Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
M
meta_base_code
Project
Project
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
黎涛
meta_base_code
Commits
74462bb0
Commit
74462bb0
authored
Dec 02, 2020
by
litaolemo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
afcfdaa6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
celery_stats_monitor.py
celery_stats/celery_stats_monitor.py
+5
-3
No files found.
celery_stats/celery_stats_monitor.py
View file @
74462bb0
...
...
@@ -23,16 +23,18 @@ class Parse_data:
self
.
offset_dict
=
{}
def
parse
(
self
,
key_name
,
len_data
,
per_sec
=
10
):
now
=
datetime
.
datetime
.
now
()
time_ts
=
now
.
strftime
(
"YYYY-MM-dd HH:mm:ss"
)
if
self
.
offset_dict
.
get
(
key_name
):
old_len_data
=
self
.
offset_dict
.
get
(
key_name
)
len_data_diff
=
old_len_data
-
len_data
rate
=
len_data_diff
/
per_sec
if
len_data_diff
>
0
:
use_time
=
round
(
len_data
/
rate
/
60
/
60
,
1
)
return
"
目前{}队列中有{}条数据,预计{}小时后处理完成"
.
format
(
key_name
,
str
(
len_data
),
str
(
use_time
))
return
"
{} 目前{}队列中有{}条数据,预计{}小时后处理完成"
.
format
(
time_ts
,
key_name
,
str
(
len_data
),
str
(
use_time
))
else
:
if
abs
(
rate
)
>
0
:
return
"{}
队列增长中,目前有{}条数据"
.
format
(
key_name
,
str
(
len_data
))
return
"{}
{}队列增长中,目前有{}条数据"
.
format
(
time_ts
,
key_name
,
str
(
len_data
))
self
.
offset_dict
[
key_name
]
=
len_data
...
...
@@ -42,7 +44,7 @@ class Parse_data:
def
len_list_and_send_msg
(
redis_clint
,
key_name
,
rules
,
per_sec
=
10
):
# redis_clint = redis.StrictRedis.from_url("redis://:ReDis!GmTx*0aN3@172.16.40.145:6379/5", decode_responses=True)
res
=
redis_clint
.
llen
(
key_name
)
print
(
res
)
print
(
key_name
,
res
)
str_res
=
rules
.
parse
(
key_name
,
res
,
per_sec
=
per_sec
)
if
str_res
:
send_msg_to_dingtalk
(
str_res
,
secret
=
secret
,
access_token
=
access_token
)
...
...
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