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
71e42e09
Commit
71e42e09
authored
Mar 05, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
send email
parent
020e8d40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
tag3_update_user_portrait_offline.py
eda/smart_rank/tag3_update_user_portrait_offline.py
+13
-10
No files found.
eda/smart_rank/tag3_update_user_portrait_offline.py
View file @
71e42e09
...
@@ -8,7 +8,7 @@ import redis
...
@@ -8,7 +8,7 @@ import redis
from
pyspark
import
SparkConf
from
pyspark
import
SparkConf
from
pyspark.sql
import
SparkSession
from
pyspark.sql
import
SparkSession
from
tool
import
get_jerry_test
,
get_tag3_user_log
,
write_user_portrait
from
tool
import
(
get_jerry_test
,
get_tag3_user_log
,
send_email
,
write_user_portrait
)
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}]
# [{'激光': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}, {'手术': 1.949194898204873}]
...
@@ -114,15 +114,18 @@ def consume_kafka():
...
@@ -114,15 +114,18 @@ def consume_kafka():
.
set
(
"spark.driver.maxResultSize"
,
"8g"
)
\
.
set
(
"spark.driver.maxResultSize"
,
"8g"
)
\
.
set
(
"spark.sql.avro.compression.codec"
,
"snappy"
)
.
set
(
"spark.sql.avro.compression.codec"
,
"snappy"
)
spark
=
SparkSession
.
builder
.
config
(
conf
=
sparkConf
)
.
enableHiveSupport
()
.
getOrCreate
()
try
:
spark
.
sparkContext
.
setLogLevel
(
"WARN"
)
spark
=
SparkSession
.
builder
.
config
(
conf
=
sparkConf
)
.
enableHiveSupport
()
.
getOrCreate
()
spark
.
sparkContext
.
addPyFile
(
"/srv/apps/ffm-baseline_git/eda/smart_rank/tool.py"
)
spark
.
sparkContext
.
setLogLevel
(
"WARN"
)
spark
.
sparkContext
.
addPyFile
(
"/srv/apps/ffm-baseline_git/eda/smart_rank/tool.py"
)
device_ids_lst_rdd
=
spark
.
sparkContext
.
parallelize
(
device_ids_lst
,
numSlices
=
1000
)
result
=
device_ids_lst_rdd
.
repartition
(
100
)
.
map
(
lambda
x
:
update_tag3_user_portrait
(
x
))
device_ids_lst_rdd
=
spark
.
sparkContext
.
parallelize
(
device_ids_lst
,
numSlices
=
1000
)
# result.foreach(print)
result
=
device_ids_lst_rdd
.
repartition
(
100
)
.
map
(
lambda
x
:
update_tag3_user_portrait
(
x
))
result
.
collect
()
# result.foreach(print)
spark
.
stop
()
result
.
collect
()
spark
.
stop
()
except
Exception
as
e
:
send_email
(
"tag3_update_user_portrait_offline"
,
"tag3_update_user_portrait_offline"
,
e
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
...
...
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