Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
ffm-baseline
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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ML
ffm-baseline
Commits
e4292ba8
Commit
e4292ba8
authored
Aug 17, 2021
by
郭羽
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
画像压缩测试
parent
cd857f64
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+21
-17
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
e4292ba8
import
datetime
import
functools
import
json
import
zlib
import
operator
from
collections
import
Counter
...
...
@@ -294,7 +295,8 @@ def update_tag3_user_portrait(cl_id):
# if tmp_res:
# res.update(tmp_res)
key
=
"doris:user_portrait:tag3:device_id:"
+
str
(
cl_id
)
key
=
"doris:user_portrait:device_id:"
+
str
(
cl_id
)
# key = "doris:user_portrait:tag3:device_id:" + str(cl_id)
redis_client
=
get_redis_client
()
user_portrait_raw
=
get_user_portrait_tag3_with_score
(
cl_id
)
...
...
@@ -314,22 +316,24 @@ def update_tag3_user_portrait(cl_id):
(
len
(
first_positions_score
.
keys
())
>
0
)
or
(
len
(
second_positions_score
.
keys
())
>
0
)
or
\
(
len
(
projects_score
.
keys
())
>
0
)
or
(
len
(
business_tags_score
.
keys
())
>
0
)
or
\
(
len
(
selected_stars_score
.
keys
())
>
0
)
or
(
len
(
selected_internet_celebrity_score
.
keys
())
>
0
):
redis_client
.
set
(
key
,
json
.
dumps
(
res
))
redis_client
.
expire
(
key
,
60
*
60
*
24
*
180
)
write_user_portrait
(
cl_id
,
","
.
join
(
first_solutions_score
.
keys
()),
","
.
join
(
second_solutions_score
.
keys
()),
","
.
join
(
first_demands_score
.
keys
()),
","
.
join
(
second_demands_score
.
keys
()),
","
.
join
(
first_positions_score
.
keys
()),
","
.
join
(
second_positions_score
.
keys
()),
","
.
join
(
projects_score
.
keys
()),
","
.
join
(
business_tags_score
.
keys
()),
","
.
join
(
selected_stars_score
.
keys
()),
","
.
join
(
selected_internet_celebrity_score
.
keys
()),
)
json_str
=
json
.
dumps
(
res
)
zlib_res
=
zlib
.
compress
(
bytes
(
json_str
,
encoding
=
'utf-8'
))
redis_client
.
set
(
key
,
zlib_res
)
redis_client
.
expire
(
key
,
60
*
60
*
24
*
90
)
# write_user_portrait(
# cl_id,
# ",".join(first_solutions_score.keys()),
# ",".join(second_solutions_score.keys()),
# ",".join(first_demands_score.keys()),
# ",".join(second_demands_score.keys()),
# ",".join(first_positions_score.keys()),
# ",".join(second_positions_score.keys()),
# ",".join(projects_score.keys()),
# ",".join(business_tags_score.keys()),
# ",".join(selected_stars_score.keys()),
# ",".join(selected_internet_celebrity_score.keys()),
# )
# body = {}
# for (k, v) in res.items():
...
...
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