Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
V
vest
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
2
Merge Requests
2
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
rank
vest
Commits
9a0d441a
Commit
9a0d441a
authored
Jan 02, 2020
by
lixiaofang
Browse files
Options
Browse Files
Download
Plain Diff
提升poll的数据
parents
5aa7237f
fa2739c8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
9 deletions
+32
-9
consum.py
moment/views/consum.py
+0
-0
process_time.py
moment/views/process_time.py
+32
-9
No files found.
moment/views/consum.py
View file @
9a0d441a
This diff is collapsed.
Click to expand it.
moment/views/process_time.py
View file @
9a0d441a
...
...
@@ -60,20 +60,20 @@ def get_one_six_days_random_time(frmt='%Y-%m-%d %H:%M:%S', num_days=0, action_ty
action_num
=
random
.
randint
(
5
,
10
)
if
num_days
<=
15
and
num_days
>
1
and
action_type
in
(
"follow"
,
"click"
)
and
int
(
content_level
)
<
3
:
action_num
=
random
.
randint
(
0
,
1
)
action_num
=
random
.
randint
(
1
,
2
)
if
num_days
<=
15
and
num_days
>
1
and
action_type
in
(
"follow"
)
and
int
(
content_level
)
>=
3
:
action_num
=
random
.
randint
(
0
,
5
)
action_num
=
random
.
randint
(
1
,
5
)
if
num_days
==
1
and
action_type
in
(
"click"
)
and
int
(
content_level
)
>=
3
:
action_num
=
random
.
randint
(
6
,
12
)
if
num_days
<=
15
and
num_days
>
1
and
action_type
in
(
"click"
)
and
int
(
content_level
)
>=
3
:
action_num
=
random
.
randint
(
0
,
6
)
action_num
=
random
.
randint
(
1
,
6
)
if
num_days
>=
1
and
num_days
<=
6
and
action_type
in
(
"comment"
):
if
int
(
content_level
)
<=
3
:
action_num
=
random
.
randint
(
0
,
1
)
action_num
=
random
.
randint
(
1
,
2
)
else
:
action_num
=
random
.
randint
(
2
,
4
)
...
...
@@ -104,24 +104,24 @@ def get_ten_last_days_random_time(num_days=None, frmt='%Y-%m-%d %H:%M:%S', conte
lastday
=
datetime
.
datetime
(
now
.
year
,
now
.
month
,
now
.
day
,
23
,
0
,
0
)
add_number
=
0
if
num_days
>
15
and
action_type
in
(
"follow"
):
action_num
=
random
.
randint
(
0
,
2
)
action_num
=
random
.
randint
(
1
,
2
)
add_number
=
10
elif
num_days
>
15
and
action_type
in
(
"click"
):
if
content_level
<
3
:
action_num
=
random
.
randint
(
0
,
1
)
action_num
=
random
.
randint
(
1
,
2
)
add_number
=
6
else
:
action_num
=
random
.
randint
(
0
,
2
)
action_num
=
random
.
randint
(
1
,
2
)
add_number
=
5
elif
num_days
>
6
and
action_type
in
(
"comment"
):
if
content_level
<=
3
:
action_num
=
random
.
randint
(
0
,
1
)
action_num
=
1
add_number
=
10
else
:
action_num
=
random
.
randint
(
0
,
2
)
action_num
=
random
.
randint
(
1
,
2
)
add_number
=
10
else
:
...
...
@@ -310,3 +310,26 @@ def get_vest_userid_and_comment(need_comment_num=0, tag_names=[], card_id=0):
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
[]
def
judge_offset_partition_have_consum
(
offset
=
0
,
partition
=
0
):
"""
根据当前的offset和分区去判断数据是否已经被消费
:param offset:
:param partition:
:return:
"""
try
:
redis_list_data
=
set
()
key
=
"irrigation_partition_offset_have_consum:"
+
str
(
partition
)
redis_data
=
redis_client
.
get
(
key
)
if
redis_data
:
redis_list_data
=
set
(
json
.
loads
(
redis_data
))
if
offset
in
redis_list_data
:
return
False
redis_list_data
.
add
(
offset
)
redis_client
.
set
(
key
,
json
.
dumps
(
list
(
redis_list_data
)))
return
True
except
:
logging
.
error
(
"catch exception,err_msg:
%
s"
%
traceback
.
format_exc
())
return
False
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