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
4dfd0071
Commit
4dfd0071
authored
Aug 16, 2019
by
高雅喆
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
dist update all tags flag
parent
b55b3596
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
70 additions
and
4 deletions
+70
-4
dist_update_user_history_order_tags.py
eda/smart_rank/dist_update_user_history_order_tags.py
+35
-2
dist_update_user_portrait.py
eda/smart_rank/dist_update_user_portrait.py
+35
-2
No files found.
eda/smart_rank/dist_update_user_history_order_tags.py
View file @
4dfd0071
...
@@ -19,6 +19,39 @@ from pyspark.sql.functions import lit
...
@@ -19,6 +19,39 @@ from pyspark.sql.functions import lit
from
pyspark.sql.functions
import
concat_ws
from
pyspark.sql.functions
import
concat_ws
def
send_email
(
app
,
id
,
e
):
# 第三方 SMTP 服务
mail_host
=
'smtp.exmail.qq.com'
# 设置服务器
mail_user
=
"gaoyazhe@igengmei.com"
# 用户名
mail_pass
=
"VCrKTui99a7ALhiK"
# 口令
sender
=
'gaoyazhe@igengmei.com'
receivers
=
[
'gaoyazhe@igengmei.com'
]
# 接收邮件,可设置为你的QQ邮箱或者其他邮箱
e
=
str
(
e
)
msg
=
MIMEMultipart
()
part
=
MIMEText
(
'app_id:'
+
id
+
':fail'
,
'plain'
,
'utf-8'
)
msg
.
attach
(
part
)
msg
[
'From'
]
=
formataddr
([
"gaoyazhe"
,
sender
])
# 括号里的对应收件人邮箱昵称、收件人邮箱账号
msg
[
'To'
]
=
";"
.
join
(
receivers
)
# message['Cc'] = ";".join(cc_reciver)
msg
[
'Subject'
]
=
'spark streaming:app_name:'
+
app
with
open
(
'error.txt'
,
'w'
)
as
f
:
f
.
write
(
e
)
f
.
close
()
part
=
MIMEApplication
(
open
(
'error.txt'
,
'r'
)
.
read
())
part
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
"error.txt"
)
msg
.
attach
(
part
)
try
:
smtpObj
=
smtplib
.
SMTP_SSL
(
mail_host
,
465
)
smtpObj
.
login
(
mail_user
,
mail_pass
)
smtpObj
.
sendmail
(
sender
,
receivers
,
msg
.
as_string
())
except
smtplib
.
SMTPException
:
print
(
'error'
)
def
get_user_history_order_service_tag
(
user_id
,
stat_date
):
def
get_user_history_order_service_tag
(
user_id
,
stat_date
):
try
:
try
:
if
user_id
:
if
user_id
:
...
@@ -82,4 +115,4 @@ if __name__ == '__main__':
...
@@ -82,4 +115,4 @@ if __name__ == '__main__':
result
.
collect
()
result
.
collect
()
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
send_email
(
"dist_update_user_history_order_tags"
,
"dist_update_user_history_order_tags"
,
""
)
\ No newline at end of file
\ No newline at end of file
eda/smart_rank/dist_update_user_portrait.py
View file @
4dfd0071
...
@@ -19,6 +19,39 @@ from pyspark.sql.functions import lit
...
@@ -19,6 +19,39 @@ from pyspark.sql.functions import lit
from
pyspark.sql.functions
import
concat_ws
from
pyspark.sql.functions
import
concat_ws
def
send_email
(
app
,
id
,
e
):
# 第三方 SMTP 服务
mail_host
=
'smtp.exmail.qq.com'
# 设置服务器
mail_user
=
"gaoyazhe@igengmei.com"
# 用户名
mail_pass
=
"VCrKTui99a7ALhiK"
# 口令
sender
=
'gaoyazhe@igengmei.com'
receivers
=
[
'gaoyazhe@igengmei.com'
]
# 接收邮件,可设置为你的QQ邮箱或者其他邮箱
e
=
str
(
e
)
msg
=
MIMEMultipart
()
part
=
MIMEText
(
'app_id:'
+
id
+
':fail'
,
'plain'
,
'utf-8'
)
msg
.
attach
(
part
)
msg
[
'From'
]
=
formataddr
([
"gaoyazhe"
,
sender
])
# 括号里的对应收件人邮箱昵称、收件人邮箱账号
msg
[
'To'
]
=
";"
.
join
(
receivers
)
# message['Cc'] = ";".join(cc_reciver)
msg
[
'Subject'
]
=
'spark streaming:app_name:'
+
app
with
open
(
'error.txt'
,
'w'
)
as
f
:
f
.
write
(
e
)
f
.
close
()
part
=
MIMEApplication
(
open
(
'error.txt'
,
'r'
)
.
read
())
part
.
add_header
(
'Content-Disposition'
,
'attachment'
,
filename
=
"error.txt"
)
msg
.
attach
(
part
)
try
:
smtpObj
=
smtplib
.
SMTP_SSL
(
mail_host
,
465
)
smtpObj
.
login
(
mail_user
,
mail_pass
)
smtpObj
.
sendmail
(
sender
,
receivers
,
msg
.
as_string
())
except
smtplib
.
SMTPException
:
print
(
'error'
)
def
compute_henqiang
(
x
):
def
compute_henqiang
(
x
):
score
=
15
-
x
*
((
15
-
0.5
)
/
180
)
score
=
15
-
x
*
((
15
-
0.5
)
/
180
)
if
score
>
0.5
:
if
score
>
0.5
:
...
@@ -152,4 +185,4 @@ if __name__ == '__main__':
...
@@ -152,4 +185,4 @@ if __name__ == '__main__':
# table="user_portrait_tags",
# table="user_portrait_tags",
# properties={"driver": 'com.mysql.jdbc.Driver'})
# properties={"driver": 'com.mysql.jdbc.Driver'})
except
Exception
as
e
:
except
Exception
as
e
:
print
(
e
)
send_email
(
"dist_update_user_portrait"
,
"dist_update_user_portrait"
,
"dist_update_user_portrait"
)
\ No newline at end of file
\ No newline at end of file
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