Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
strategy_embedding
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
rank
strategy_embedding
Commits
7ff8f681
Commit
7ff8f681
authored
Nov 05, 2020
by
赵威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
get device data
parent
a720cfdb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
0 deletions
+19
-0
get_tractate_data.py
dssm/get_tractate_data.py
+19
-0
No files found.
dssm/get_tractate_data.py
View file @
7ff8f681
...
...
@@ -19,6 +19,10 @@ def get_ndays_before_no_minus(n):
return
get_ndays_before_with_format
(
n
,
"
%
Y
%
m
%
d"
)
def
get_ndays_before
(
n
):
return
get_ndays_before_with_format
(
n
,
"
%
Y-
%
m-
%
d"
)
def
connect_doris
(
spark
,
table
):
return
spark
.
read
.
format
(
"jdbc"
)
\
.
option
(
"driver"
,
"com.mysql.jdbc.Driver"
)
\
...
...
@@ -62,6 +66,9 @@ def get_spark(app_name=""):
return
spark
### get data
def
get_click_data
(
spark
,
card_type
,
start
,
end
):
reg
=
r"""^\\d+$"""
sql
=
"""
...
...
@@ -369,6 +376,15 @@ def get_card_feature_df(spark, card_type, yesterday):
return
spark
.
sql
(
sql
)
def
get_device_tags
(
spark
):
sql
=
"""
SELECT cl_id, first_demands, first_solutions, first_positions, second_demands, second_solutions, second_positions, projects
FROM user_tag3_portrait
WHERE date = '{}'
"""
.
format
(
get_ndays_before
(
1
))
return
spark
.
sql
(
sql
)
if
__name__
==
"__main__"
:
spark
=
get_spark
(
"dssm_tractate_data"
)
card_type
=
"user_post"
...
...
@@ -383,4 +399,7 @@ if __name__ == "__main__":
tractate_feature_df
=
get_card_feature_df
(
spark
,
card_type
,
end
)
tractate_feature_df
.
show
(
5
,
False
)
device_feature_df
=
get_device_tags
(
spark
)
device_feature_df
.
show
(
5
,
False
)
# spark-submit --master yarn --deploy-mode client --queue root.strategy --driver-memory 16g --executor-memory 1g --executor-cores 1 --num-executors 70 --conf spark.default.parallelism=100 --conf spark.storage.memoryFraction=0.5 --conf spark.shuffle.memoryFraction=0.3 --conf spark.locality.wait=0 --jars /srv/apps/tispark-core-2.1-SNAPSHOT-jar-with-dependencies.jar,/srv/apps/spark-connector_2.11-1.9.0-rc2.jar,/srv/apps/mysql-connector-java-5.1.38.jar /srv/apps/strategy_embedding/dssm/get_tractate_data.py
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