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
c065dee7
Commit
c065dee7
authored
May 21, 2020
by
任婷婷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
c57a36c7
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
12 deletions
+14
-12
test_divided_portrait.py
eda/smart_rank/test_divided_portrait.py
+1
-9
tool.py
eda/smart_rank/tool.py
+13
-3
No files found.
eda/smart_rank/test_divided_portrait.py
View file @
c065dee7
...
...
@@ -25,7 +25,7 @@ def get_user_portrait_log(cl_id):
try
:
sql
=
"""select cl_id,event_cn, first_solutions, second_solutions, first_demands,
second_demands, first_positions, second_positions, projects
from kafka_tag3_log where cl_id
in {} """
.
format
(
tuple
(
cl_id
)
)
from kafka_tag3_log where cl_id
= '{}' """
.
format
(
cl_id
)
db
,
cursor
=
get_jerry_test
()
cursor
.
execute
(
sql
)
data
=
list
(
cursor
.
fetchall
())
...
...
@@ -68,14 +68,6 @@ def user_portrait_action_statistic(cl_id):
"first_positions"
:
ud6_list
,
"second_positions"
:
ud7_list
,
"projects"
:
ud8_list
}
# ud_dict[ud[0]][ud[1]]["first_solutions"] = ud2_list
# ud_dict[ud[0]][ud[1]]["second_solutions"] = ud3_list
# ud_dict[ud[0]][ud[1]]["first_demands"] = ud4_list
# ud_dict[ud[0]][ud[1]]["second_demands"] = ud5_list
# ud_dict[ud[0]][ud[1]]["first_positions"] = ud6_list
# ud_dict[ud[0]][ud[1]]["second_positions"] =ud7_list
# ud_dict[ud[0]][ud[1]]["projects"] = ud8_list
else
:
ud_dict
[
ud
[
0
]]
=
{}
ud_dict
[
ud
[
0
]][
ud
[
1
]]
=
{
"first_solutions"
:
ud2_list
,
"second_solutions"
:
ud3_list
,
...
...
eda/smart_rank/tool.py
View file @
c065dee7
...
...
@@ -442,12 +442,23 @@ def write_user_portrait(cl_id, first_solutions, second_solutions, first_demands,
print
(
e
)
def
connect_mysql
():
db
=
pymysql
.
connect
(
host
=
"172.16.30.136"
,
port
=
3306
,
user
=
"doris"
,
password
=
"o5gbA27hXHHm"
,
db
=
"doris_prod"
,
charset
=
"utf8"
)
return
db
,
db
.
cursor
()
def
get_user_portrait_log
(
cl_id
):
# try:
sql
=
"""select cl_id,event_cn, first_solutions, second_solutions, first_demands,
second_demands, first_positions, second_positions, projects
from kafka_tag3_log where cl_id = '{}' """
.
format
(
cl_id
)
db
,
cursor
=
get_jerry_test
()
db
,
cursor
=
connect_mysql
()
cursor
.
execute
(
sql
)
data
=
list
(
cursor
.
fetchall
())
db
.
close
()
...
...
@@ -469,7 +480,6 @@ def user_portrait_action_statistic(cl_id):
print
(
'-'
*
100
)
if
user_df
:
for
ud
in
user_df
:
ud2_list
=
ud
[
2
]
.
split
(
","
)
ud3_list
=
ud
[
3
]
.
split
(
","
)
ud4_list
=
ud
[
4
]
.
split
(
","
)
...
...
@@ -515,7 +525,7 @@ def write_user_portrait_action_divided(cl_id,event_cn,first_solutions, second_so
yesterday
,
cl_id
,
event_cn
,
","
.
join
(
first_solutions
),
","
.
join
(
second_solutions
),
","
.
join
(
first_demands
),
","
.
join
(
second_demands
),
","
.
join
(
first_positions
),
","
.
join
(
second_positions
),
","
.
join
(
projects
))
db
,
cursor
=
get_jerry_test
()
db
,
cursor
=
connect_mysql
()
cursor
.
execute
(
sql
)
db
.
commit
()
db
.
close
()
...
...
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