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
abb30700
Commit
abb30700
authored
Nov 27, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send msg to ding talk
parent
f920de06
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
13 deletions
+13
-13
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+13
-13
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
abb30700
...
@@ -9,7 +9,7 @@ from pyspark import SparkConf
...
@@ -9,7 +9,7 @@ from pyspark import SparkConf
from
pyspark.sql
import
SparkSession
from
pyspark.sql
import
SparkSession
from
tool
import
(
get_doris_prod
,
get_redis_client
,
get_tag3_user_log
,
get_tag3_user_order_log
,
get_user_portrait_tag3_with_score
,
from
tool
import
(
get_doris_prod
,
get_redis_client
,
get_tag3_user_log
,
get_tag3_user_order_log
,
get_user_portrait_tag3_with_score
,
send_
email
,
write_user_portrait
,
send_msg_to_dingtalk
)
send_
msg_to_dingtalk
,
write_user_portrait
)
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873, '植发际线': 7.1}]
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873, '植发际线': 7.1}]
...
@@ -327,6 +327,7 @@ def update_tag3_user_portrait(cl_id):
...
@@ -327,6 +327,7 @@ def update_tag3_user_portrait(cl_id):
def
consume_kafka
():
def
consume_kafka
():
start
=
datetime
.
datetime
.
now
()
sql
=
"select distinct cl_id from kafka_tag3_log where log_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day))"
sql
=
"select distinct cl_id from kafka_tag3_log where log_time > UNIX_TIMESTAMP(DATE_SUB(NOW(), INTERVAL 30 day))"
db
,
cursor
=
get_doris_prod
()
db
,
cursor
=
get_doris_prod
()
cursor
.
execute
(
sql
)
cursor
.
execute
(
sql
)
...
@@ -360,28 +361,27 @@ def consume_kafka():
...
@@ -360,28 +361,27 @@ def consume_kafka():
# result2.foreach(print)
# result2.foreach(print)
# result2.collect()
# result2.collect()
end
=
datetime
.
datetime
.
now
()
msg_dict
=
{
"start"
:
str
(
start
),
"end"
:
str
(
end
),
"device_number"
:
len
(
device_ids_lst
)}
msg_res
=
""
for
(
k
,
v
)
in
msg_dict
.
items
():
msg_res
+=
str
(
k
)
msg_res
+=
": "
msg_res
+=
str
(
v
)
msg_res
+=
"
\n
"
send_msg_to_dingtalk
(
msg_res
)
spark
.
stop
()
spark
.
stop
()
except
Exception
as
e
:
except
Exception
as
e
:
send_
email
(
"tag3_update_user_portrait_offline"
,
"tag3_update_user_portrait_offline"
,
e
)
send_
msg_to_dingtalk
(
"tag3_update_user_portrait_offline
\n
"
+
str
(
e
)
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
start
=
datetime
.
datetime
.
now
()
start
=
datetime
.
datetime
.
now
()
# update_tag3_user_portrait("862460044588666")
# update_tag3_user_portrait("androidid_a25a1129c0b38f7b")
# cl_id = "864350041167473"
# df = get_tag3_user_log(cl_id)
# df[["projects", "business_tags"]]
# update_tag3_user_portrait(cl_id)
# cl_id = "867617044159377"
# cl_id = "867617044159377"
# print(update_tag3_user_portrait(cl_id))
# print(update_tag3_user_portrait(cl_id))
# consume_kafka()
consume_kafka
()
send_msg_to_dingtalk
(
"test"
)
end
=
datetime
.
datetime
.
now
()
end
=
datetime
.
datetime
.
now
()
print
(
end
-
start
)
print
(
end
-
start
)
print
(
"done"
)
print
(
"done"
)
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