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
f0ab152d
Commit
f0ab152d
authored
Aug 05, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
try write data
parent
1e2860ff
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
18 deletions
+13
-18
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+13
-18
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
f0ab152d
...
@@ -4,17 +4,16 @@ import json
...
@@ -4,17 +4,16 @@ import json
import
operator
import
operator
from
collections
import
Counter
from
collections
import
Counter
import
pymysql
import
pytz
import
pytz
import
redis
import
redis
import
pymysql
from
es_tool
import
es_insert_device_info
from
pyspark
import
SparkConf
from
pyspark
import
SparkConf
from
pyspark.sql
import
SparkSession
from
pyspark.sql
import
SparkSession
from
tool
import
(
get_doris_prod
,
get_jerry_test
,
get_redis_client
,
get_tag3_user_log
,
get_user_portrait_tag3_from_redis
,
from
es_tool
import
es_insert_device_info
get_user_portrait_tag3_with_score
,
send_email
,
write_user_portrait
,
from
tool
import
(
get_doris_prod
,
get_jerry_test
,
get_redis_client
,
get_tag3_user_log
,
get_user_portrait_tag3_from_redis
,
write_user_portrait_by_event
,
write_user_portrait_doris
)
get_user_portrait_tag3_with_score
,
send_email
,
write_user_portrait
,
write_user_portrait_by_event
,
write_user_portrait_doris
)
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873, '植发际线': 7.1}]
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873, '植发际线': 7.1}]
...
@@ -268,15 +267,13 @@ def update_tag3_user_portrait(cl_id):
...
@@ -268,15 +267,13 @@ def update_tag3_user_portrait(cl_id):
(
len
(
first_solutions_score
.
keys
())
>
0
)
or
(
len
(
second_solutions_score
.
keys
())
>
0
)
or
\
(
len
(
first_solutions_score
.
keys
())
>
0
)
or
(
len
(
second_solutions_score
.
keys
())
>
0
)
or
\
(
len
(
first_positions_score
.
keys
())
>
0
)
or
(
len
(
second_positions_score
.
keys
())
>
0
)
or
\
(
len
(
first_positions_score
.
keys
())
>
0
)
or
(
len
(
second_positions_score
.
keys
())
>
0
)
or
\
(
len
(
projects_score
.
keys
())
>
0
):
(
len
(
projects_score
.
keys
())
>
0
):
pass
redis_client
.
set
(
key
,
json
.
dumps
(
res
))
# TODO
redis_client
.
expire
(
key
,
60
*
60
*
24
*
180
)
# 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()),
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_demands_score
.
keys
()),
","
.
join
(
second_demands_score
.
keys
()),
#
",".join(first_positions_score.keys()), ",".join(second_positions_score.keys()),
","
.
join
(
first_positions_score
.
keys
()),
","
.
join
(
second_positions_score
.
keys
()),
#
",".join(projects_score.keys()))
","
.
join
(
projects_score
.
keys
()))
body
=
{}
body
=
{}
for
(
k
,
v
)
in
res
.
items
():
for
(
k
,
v
)
in
res
.
items
():
...
@@ -285,9 +282,7 @@ def update_tag3_user_portrait(cl_id):
...
@@ -285,9 +282,7 @@ def update_tag3_user_portrait(cl_id):
body
[
"device_id"
]
=
cl_id
body
[
"device_id"
]
=
cl_id
body
[
"last_modified"
]
=
datetime
.
datetime
.
strftime
(
datetime
.
datetime
.
now
(
pytz
.
timezone
(
"Asia/Shanghai"
)),
body
[
"last_modified"
]
=
datetime
.
datetime
.
strftime
(
datetime
.
datetime
.
now
(
pytz
.
timezone
(
"Asia/Shanghai"
)),
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S.
%
f"
)[:
-
7
]
+
"Z"
"
%
Y-
%
m-
%
dT
%
H:
%
M:
%
S.
%
f"
)[:
-
7
]
+
"Z"
es_insert_device_info
(
cl_id
,
body
)
print
(
body
)
# es_insert_device_info(cl_id, body)
# # write_user_portrait_doris(cl_id, ",".join(first_solutions_score.keys()), ",".join(second_solutions_score.keys()),
# # write_user_portrait_doris(cl_id, ",".join(first_solutions_score.keys()), ",".join(second_solutions_score.keys()),
# # ",".join(first_demands_score.keys()), ",".join(second_demands_score.keys()),
# # ",".join(first_demands_score.keys()), ",".join(second_demands_score.keys()),
...
...
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